Closed sandra-ab closed 3 years ago
Hi @sandra-ab - thanks for the excellent bug report! I'll investigate shortly
Hi @sandra-ab - it seems to have been a bug with the bundled version of mapshaper I was using. I've upgraded it, can you test with the development version? You can install with:
# install.packages("remotes")
remotes::install_github("ateucher/rmapshaper", ref = "fix-erase-bug")
Thank you so much @ateucher - works perfectly now!
That's excellent - thank you for the report!
Hi,
First of all thanks for rmapshaper, it is a wonderfully handy package.
I have been occasionally encountering a quirk using
ms_erase
and can’t really figure out what is happening.For context, I am using the function in a habitat mapping toolkit, and users can supply their own spatial file of hedgerows that then get added to a vector land cover map (OS MasterMap). The (simplified) workflow for this is:
ms_erase
) the corresponding area from the basemap polygonsNow this works beautifully almost every time (> 99.9%), but once in a while the returned output of
ms_erase
is missing part of a polygon, leaving a gaping hole in my map. In the example here, I also noticed that this does not happen when I use the system rmapshaper instead. The plot shows my two input layers (left), the problem (center), and the expected correct outcome (right; using system rmapshaper or QGIS). Sorry I couldn’t reproduce the problem with simpler data, but as I said it only happens very rarely - and I can't figure out what combination of features sets it off (all input polygons are valid sf single-part polygons). I am attaching the two layers shown in the plots: hedgemap.zipAny pointers on what the problem might be would be greatly appreciated. I would prefer not forcing my users to install Node.js.
My code:
And the output of
sessionInfo()
:Thank you, Sandra