mbloch / mapshaper

Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
http://mapshaper.org
Other
3.78k stars 535 forks source link

filter-islands removing single ring polygons #400

Open ericemc3 opened 4 years ago

ericemc3 commented 4 years ago

the doc states: "Remove small detached polygon rings (islands)".

i am still confused with how it works: i am expecting it to apply filter on multipolygons only and remove external rings depending on an area threshold. But i can see simple polygons (one single ring) erased and conversely some external rings not erased.

image

What i would like: prevent shape removal and simplify multipolygons with many islands

mbloch commented 4 years ago

I agree that -filter-islands could be improved. I'd like to propose the following changes.

  1. Adding a keep-shapes option to -filter-islands, analogous to the keep-shapes option of the -simplify command. This would protect each feature's largest ring from removal.

  2. Currently, -filter-islands only identifies detached rings as islands. It does not detect groups of adjacent rings as islands (like the two-ring island in your example). I think it would be an improvement to detect and remove multi-ring islands.

t seems to me that these changes would help with your use case... if not, please let me know.

ericemc3 commented 4 years ago

Thank you Matt for your explanations, especially regarding point 2. I understand that it makes sense not removing these rings by default, as they are not real islands.

And i am absolutely voting for your keep-shapes option to -filter-islands! It will save time for my work. No need to see that i love mapshaper, which is incredibly fast and handy.