sf_remove_holes | R Documentation |
Removes holes from polygons and multipolygons. Points and linestrings are unaffected.
sf_remove_holes(obj, close = TRUE)
obj |
sfg, sfc or sf object. |
close |
logical indicating whether polygons should be closed. If |
df <- data.frame(
ml_id = c(1,1,1,1,1,1,1,1,1,2,2,2,2,2,2)
, l_id = c(1,1,1,2,2,2,3,3,3,1,1,1,2,2,2)
, x = rnorm(15)
, y = rnorm(15)
, z = rnorm(15)
, m = rnorm(15)
)
sfg <- sfg_polygon( obj = df, x = "x", y = "y", linestring_id = "ml_id" )
sfc <- sfc_polygon( obj = df, x = "x", y = "y", polygon_id = "ml_id", linestring_id = "l_id" )
sf <- sf_polygon( obj = df, x = "x", y = "y", polygon_id = "ml_id", linestring_id = "l_id" )
sf_remove_holes( sfg )
sf_remove_holes( sfc )
sf_remove_holes( sf )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.