Closed JonasGeschke closed 2 years ago
Hi, yeah sometimes st_union
can output overlapping polygons depending on the precision of the
geoprocessing calculations. Maybe something like this would work (assuming you called your rbind'd WDPA dataset w
)? If it doesn't, try increasing the prec
object.
library(sf)
library(lwgeom)
prec <- 1e+8
x <- st_make_valid(st_precision(st_union(st_precision(st_combine(x), prec)), prec))
Just to follow up, did my suggestion work? Or are you still experiencing issues with dissolving the WDPA? If possible, I'd recommend using ESRI ArcMap to process the global WDPA since it's more robust to geometry issues and runs a lot faster.
Hi, thanks for your follow-up. I am still on it ...
OK - let me know how it goes. You might need to try various precision levels. I would also recommend dissolving each country together separately and then assembling the global dataset. However, this is still going to be a very difficult (if impossible) task given the limits of FOSS GIS software.
Actually #19 is my bottleneck at the moment. It keeps coming up. Would be great if you can have a look at this.
I am working on a HPC cluster now, so processing capacity is no bottleneck anymore. It seems to be working with simply using wdpaunion <- st_union(st_make_valid(wdpaclean))
. Will let you know if succeeding when the whole dataset is done – and then also close the issue if successful.
I've just added a wdpa_dissolve()
to the latest GitHub version which should implement this functionality (see https://prioritizr.github.io/wdpar/reference/wdpa_dissolve.html). Please feel free to reopen this issue if you run into any issues with it.
Hi @jeffreyhanson, while I am about to finish cleaning all WDPA country subsets, I tried putting them all together, in order to finally get a "flattened WDPA layer". However, both with
st_combine
orst_union
and withrbind
and a secondwdpa_clean
it seems not to be working properly. I always get some areas overlapping and thus double counting in any area calculations. Therefore, as you know the details of your package: Could you put together a functionwdpa_merge
that puts together subsets of the WDPA and cleans the overlaps between countries? (in theory this should be transboundary protected areas only) That would be great ...