mapshaper icon indicating copy to clipboard operation
mapshaper copied to clipboard

filter-islands removing single ring polygons

Open ericemc3 opened this issue 6 years ago • 2 comments

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

ericemc3 avatar Feb 29 '20 13:02 ericemc3

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.

mbloch avatar Mar 01 '20 00:03 mbloch

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.

ericemc3 avatar Mar 01 '20 11:03 ericemc3