- Notifications
You must be signed in to change notification settings - Fork299
Closed
Description
Lately, I've tried to aggregate some spatial data without unioning them. This process often ends with non-valid polygons (see the last example below), however aggregation with union works fine. Original data are also valid. Is is possible to improve it on thesf part or usinglwgeom::st_make_valid() is the only feasible solution?
The sample data is attached -map.zip.
library(sf) library(lwgeom)#> Linking to liblwgeom 2.3.2 r15302, GEOS 3.6.1, proj.4 4.9.3map= st_read("/vsizip/map.zip")# check if map is validall(st_is_valid(map))#> [1] TRUE# aggregate and union themmap_aggr_union= aggregate(map,by=list(group=map$NAME),FUN=function(x)x[1],do_union=TRUE)# check if map_aggr_union is validall(st_is_valid(map_aggr_union))#> [1] TRUE# aggregate themmap_aggr= aggregate(map,by=list(group=map$NAME),FUN=function(x)x[1],do_union=FALSE)# check if map_aggr is validall(st_is_valid(map_aggr))#> [1] FALSE
Metadata
Metadata
Assignees
Labels
No labels