constructs sfg MULTIPOINT object

sfg_multipoint(obj, x = NULL, y = NULL, z = NULL, m = NULL)

Arguments

obj

matrix or data.frame

x

x geometry column

y

y geometry column

z

z geometry column

m

m geometry column

Value

sfg object of MULTIPOINT geometry

Examples


sfg_multipoint( 1:2 )
#>      [,1] [,2]
#> [1,]    1    2
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
sfg_multipoint( 1:3 )
#>      [,1] [,2] [,3]
#> [1,]    1    2    3
#> attr(,"class")
#> [1] "XYZ"        "MULTIPOINT" "sfg"       
sfg_multipoint( 1:4 )
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    2    3    4
#> attr(,"class")
#> [1] "XYZM"       "MULTIPOINT" "sfg"       

sfg_multipoint( matrix( 1:3, ncol = 3 ) )
#>      [,1] [,2] [,3]
#> [1,]    1    2    3
#> attr(,"class")
#> [1] "XYZ"        "MULTIPOINT" "sfg"       
sfg_multipoint( data.frame( x = 1, y = 2, z = 3 )  )
#>      [,1] [,2] [,3]
#> [1,]    1    2    3
#> attr(,"class")
#> [1] "XYZ"        "MULTIPOINT" "sfg"       

sfg_multipoint( matrix( 1:4, ncol = 2 ) )
#>      [,1] [,2]
#> [1,]    1    3
#> [2,]    2    4
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
sfg_multipoint( matrix( 1:24, ncol = 2, byrow = TRUE ) )
#>       [,1] [,2]
#>  [1,]    1    2
#>  [2,]    3    4
#>  [3,]    5    6
#>  [4,]    7    8
#>  [5,]    9   10
#>  [6,]   11   12
#>  [7,]   13   14
#>  [8,]   15   16
#>  [9,]   17   18
#> [10,]   19   20
#> [11,]   21   22
#> [12,]   23   24
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
sfg_multipoint( matrix( 1:24, ncol = 3, byrow = TRUE ) )
#>      [,1] [,2] [,3]
#> [1,]    1    2    3
#> [2,]    4    5    6
#> [3,]    7    8    9
#> [4,]   10   11   12
#> [5,]   13   14   15
#> [6,]   16   17   18
#> [7,]   19   20   21
#> [8,]   22   23   24
#> attr(,"class")
#> [1] "XYZ"        "MULTIPOINT" "sfg"       
sfg_multipoint( matrix( 1:24, ncol = 4, byrow = TRUE ) )
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    2    3    4
#> [2,]    5    6    7    8
#> [3,]    9   10   11   12
#> [4,]   13   14   15   16
#> [5,]   17   18   19   20
#> [6,]   21   22   23   24
#> attr(,"class")
#> [1] "XYZM"       "MULTIPOINT" "sfg"       

sfg_multipoint( data.frame( x = 1:5, y = 1:5 ) )
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    2    2
#> [3,]    3    3
#> [4,]    4    4
#> [5,]    5    5
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       

## using columns

sfg_multipoint( matrix( 1:24, ncol = 4, byrow = TRUE ), x = 1, y = 2 )
#>      [,1] [,2]
#> [1,]    1    2
#> [2,]    5    6
#> [3,]    9   10
#> [4,]   13   14
#> [5,]   17   18
#> [6,]   21   22
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
sfg_multipoint( matrix( 1:24, ncol = 4, byrow = TRUE ), x = 1, y = 2, z = 3 )
#>      [,1] [,2] [,3]
#> [1,]    1    2    3
#> [2,]    5    6    7
#> [3,]    9   10   11
#> [4,]   13   14   15
#> [5,]   17   18   19
#> [6,]   21   22   23
#> attr(,"class")
#> [1] "XYZ"        "MULTIPOINT" "sfg"       
sfg_multipoint( matrix( 1:24, ncol = 4, byrow = TRUE ), x = 3, y = 4 )
#>      [,1] [,2]
#> [1,]    3    4
#> [2,]    7    8
#> [3,]   11   12
#> [4,]   15   16
#> [5,]   19   20
#> [6,]   23   24
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       

df <- data.frame( x = 1:5, y = 1:5, z = 11:15, m = 11:15 )
sfg_multipoint( df, x = "x", y = "y" )
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    2    2
#> [3,]    3    3
#> [4,]    4    4
#> [5,]    5    5
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
sfg_multipoint( df, x = "x", y = "y", z = "z" )
#>      [,1] [,2] [,3]
#> [1,]    1    1   11
#> [2,]    2    2   12
#> [3,]    3    3   13
#> [4,]    4    4   14
#> [5,]    5    5   15
#> attr(,"class")
#> [1] "XYZ"        "MULTIPOINT" "sfg"       
sfg_multipoint( df, x = "x", y = "y", z = "z", m = "m" )
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    1   11   11
#> [2,]    2    2   12   12
#> [3,]    3    3   13   13
#> [4,]    4    4   14   14
#> [5,]    5    5   15   15
#> attr(,"class")
#> [1] "XYZM"       "MULTIPOINT" "sfg"