constructs sfc of MULTIPOINT objects

sfc_multipoint(
  obj,
  x = NULL,
  y = NULL,
  z = NULL,
  m = NULL,
  multipoint_id = NULL
)

Arguments

obj

sorted matrix or data.frame

x

x geometry column

y

y geometry column

z

z geometry column

m

m geometry column

multipoint_id

column of ids for multipoints

Value

sfc object of MULTIPOINT geometries

notes

sfheaders functions do not perform any validity checks on the geometries. Nor do they set Coordinate Reference Systems, EPSG, PROJ4 or precision attributes.

The data.frame and matrices you send into the sfheader functions must be ordered.

Examples


x <- matrix( c(1:4), ncol = 2 )
sfc_multipoint( x )
#> [[1]]
#>      [,1] [,2]
#> [1,]    1    3
#> [2,]    2    4
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTIPOINT" "sfc"           
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    3    2    4 
#> attr(,"class")
#> [1] "bbox"

x <- data.frame( id = 1:2, x = 1:2, y = 2:1 )
sfc_multipoint( x )
#> [[1]]
#>      [,1] [,2] [,3]
#> [1,]    1    1    2
#> [2,]    2    2    1
#> attr(,"class")
#> [1] "XYZ"        "MULTIPOINT" "sfg"       
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTIPOINT" "sfc"           
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    1    2    2 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax 
#>    1    2 
#> attr(,"class")
#> [1] "z_range"
sfc_multipoint( x, x = "x", y = "y" )
#> [[1]]
#>      [,1] [,2]
#> [1,]    1    2
#> [2,]    2    1
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTIPOINT" "sfc"           
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    1    2    2 
#> attr(,"class")
#> [1] "bbox"
sfc_multipoint( x, x = "y", y = "x" )
#> [[1]]
#>      [,1] [,2]
#> [1,]    2    1
#> [2,]    1    2
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTIPOINT" "sfc"           
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    1    2    2 
#> attr(,"class")
#> [1] "bbox"
sfc_multipoint( x, multipoint_id = "id", x = "x", y = "y")
#> [[1]]
#>      [,1] [,2]
#> [1,]    1    2
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
#> 
#> [[2]]
#>      [,1] [,2]
#> [1,]    2    1
#> attr(,"class")
#> [1] "XY"         "MULTIPOINT" "sfg"       
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTIPOINT" "sfc"           
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    1    2    2 
#> attr(,"class")
#> [1] "bbox"