Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request for "wdpa_merge()" #22

Closed
JonasGeschke opened this issue Feb 21, 2020 · 7 comments
Closed

request for "wdpa_merge()" #22

JonasGeschke opened this issue Feb 21, 2020 · 7 comments
Assignees

Comments

@JonasGeschke
Copy link

JonasGeschke commented Feb 21, 2020

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 or st_union and with rbind and a second wdpa_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 function wdpa_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 ...

@JonasGeschke JonasGeschke changed the title request for "wdpar_merge()" request for "wdpa_merge()" Feb 21, 2020
@jeffreyhanson
Copy link
Collaborator

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))

@jeffreyhanson jeffreyhanson self-assigned this Feb 23, 2020
@jeffreyhanson
Copy link
Collaborator

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.

@JonasGeschke
Copy link
Author

Hi, thanks for your follow-up. I am still on it ...

@jeffreyhanson
Copy link
Collaborator

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.

@JonasGeschke
Copy link
Author

Actually #19 is my bottleneck at the moment. It keeps coming up. Would be great if you can have a look at this.

@JonasGeschke
Copy link
Author

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.

@jeffreyhanson
Copy link
Collaborator

jeffreyhanson commented Oct 24, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants