Simplify MULTIPOLYGON to POLYGON geometry in an sf class object
Source: R/simplify_multipolygon_crowns.R
simplify_multipolygon_crowns.RdFunction to simplify MULTIPOLYGON geometry to POLYGON geometry in an sf class object by selecting the largest segment of the MULTIPOLYGON
Arguments
- trees_poly
data.frame. A data frame of
sfclass with POLYGON,MULTIPOLYGON geometry (seesf::st_geometry_type()) and the columntreeID
Examples
if (FALSE) { # \dontrun{
f <- paste0(system.file(package = "cloud2trees"),"/extdata/crowns_poly.gpkg")
crowns <- sf::st_read(f, quiet = T)
crowns %>% sf::st_geometry_type() %>% table()
crowns_simp <- simplify_multipolygon_crowns(crowns)
crowns_simp %>% sf::st_geometry_type() %>% table()
} # }