sfg_polygon {sfheaders} | R Documentation |
sfg polygon
Description
constructs sfg POLYGON object
Usage
sfg_polygon(
obj,
x = NULL,
y = NULL,
z = NULL,
m = NULL,
linestring_id = NULL,
close = TRUE
)
Arguments
obj |
matrix or data.frame |
x |
x geometry column |
y |
y geometry column |
z |
z geometry column |
m |
m geometry column |
linestring_id |
column of ids for lines (within polygons) |
close |
logical indicating whether polygons should be closed. If |
Value
sfg
object of POLYGON geometry
Examples
sfg_polygon( matrix( 1:24, ncol = 2 ) )
sfg_polygon( matrix( 1:24, ncol = 3 ) )
sfg_polygon( matrix( 1:24, ncol = 4 ) )
## different lines
m <- cbind( matrix( 1:24, ncol = 2 ), c(rep(1, 6), rep(2, 6) ) )
sfg_polygon( obj = m, x = 1, y = 2, linestring_id = 3 )
## just specifying linestring_id will use all others as the geometries
sfg_polygon( obj = m, linestring_id = 3 )
df <- data.frame( x = 1:12, y = 1:12, z = 13:24, id = c(rep(1,6), rep(2,6)))
sfg_polygon( df, x = "x", y = "y" )
sfg_polygon( df, x = "x", y = "y", linestring_id = "id" )
sfg_polygon( df, linestring_id = "id" )
[Package sfheaders version 0.4.4 Index]