constructs sfc of POINT objects

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

Arguments

obj

sorted vector, matrix or data.frame

x

x geometry column

y

y geometry column

z

z geometry column

m

m geometry column

Value

sfc object of POINT 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 <- c(1:3)
sfc_point( x )
#> [[1]]
#> [1] 1 2 3
#> attr(,"class")
#> [1] "XYZ"   "POINT" "sfg"  
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POINT" "sfc"      
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    2    1    2 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax 
#>    3    3 
#> attr(,"class")
#> [1] "z_range"

x <- matrix( c(1:10) , ncol = 2 )
sfc_point( x )
#> [[1]]
#> [1] 1 6
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[2]]
#> [1] 2 7
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[3]]
#> [1] 3 8
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[4]]
#> [1] 4 9
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[5]]
#> [1]  5 10
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POINT" "sfc"      
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    6    5   10 
#> attr(,"class")
#> [1] "bbox"

x <- setNames( as.data.frame( x ), c("x","y") )
sfc_point( x )
#> [[1]]
#> [1] 1 6
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[2]]
#> [1] 2 7
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[3]]
#> [1] 3 8
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[4]]
#> [1] 4 9
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[5]]
#> [1]  5 10
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POINT" "sfc"      
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    6    5   10 
#> attr(,"class")
#> [1] "bbox"
sfc_point( obj = x, x = "x", y = "y" )
#> [[1]]
#> [1] 1 6
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[2]]
#> [1] 2 7
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[3]]
#> [1] 3 8
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[4]]
#> [1] 4 9
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[5]]
#> [1]  5 10
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POINT" "sfc"      
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    1    6    5   10 
#> attr(,"class")
#> [1] "bbox"
sfc_point( obj = x, x = "y", y = "x" )
#> [[1]]
#> [1] 6 1
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[2]]
#> [1] 7 2
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[3]]
#> [1] 8 3
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[4]]
#> [1] 9 4
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> [[5]]
#> [1] 10  5
#> attr(,"class")
#> [1] "XY"    "POINT" "sfg"  
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POINT" "sfc"      
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    6    1   10    5 
#> attr(,"class")
#> [1] "bbox"