Skip to content
Prev 27651 / 29559 Next

dissolve internal borders of polygons using st_union and group_by

On Thu, 17 Oct 2019, Roger Bivand wrote:

            
But:

library(rgeos)
wm <- as(world_map, "Spatial")
cs <- gUnaryUnion(wm, id=as.character(wm$continent))
cs_sf <- st_as_sf(cs)
cs_sf$continent <- row.names(cs)
cs_sf
object.size(cs_sf)
plot(cs_sf)

gets much closer.

Maybe try st_precision() for some suitable value? The precision model in 
rgeos multiplies all coordinates by 1e+8 and rounds to integer, reducing 
boundary slivers.

Roger