sfg_polygon | R Documentation |
constructs sfg POLYGON object
sfg_polygon(
obj,
x = NULL,
y = NULL,
z = NULL,
m = NULL,
linestring_id = NULL,
close = TRUE
)
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 |
sfg
object of POLYGON geometry
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" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.