sf_point {sfheaders} | R Documentation |
sf POINT
Description
constructs sf of POINT objects
Usage
sf_point(obj, x = NULL, y = NULL, z = NULL, m = NULL, keep = FALSE)
Arguments
obj |
sorted vector, matrix or data.frame |
x |
x geometry column |
y |
y geometry column |
z |
z geometry column |
m |
m geometry column |
keep |
logical indicating if the non-geometry and non-id columns should be kept. if TRUE you must supply the geometry and id columns, and only the first row of each geometry is kept. See Keeping Properties. |
Value
sf
object of POINT geometries
Keeping Properties
Setting keep = TRUE
will retain any columns not specified as a
coordinate (x, y, z, m) or an id (e.g., linestring_id, polygon_id) of the input obj
.
You can use list_columns
to specify which of the properties will be turned into
a list, thus keeping all the values in the column. For columns not specified in list_columns
,
only the first row of the column is kept
The sf_*
functions assume the input obj
is a long data.frame / matrix,
where any properties are repeated down the table for the same geometry.
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)
sf_point( x )
x <- matrix( c(1:10) , ncol = 2 )
sf_point( x )
x <- setNames( as.data.frame( x ), c("x","y") )
sf_point( x )
sf_point( obj = x, x = "x", y = "y" )
sf_point( obj = x, x = "y", y = "x" )
# keeping properties
x$val <- letters[1:5]
sf_point( x, x = "x", y = "y", keep = TRUE )