
Notice the big fjords and other fine work by Slartibartfast. ST_Simplify will not do what we need, since it removes redundant vertices within a tolerance. So the fjords will have fewer vertices, but they'll still be there.
However, it turns out there is a solution, and I didn't even need a long walk in the snow to figure it out. If we buffer by a large amount, then reverse the buffer by the same amount, we'll get something that has a similar shape to the original, but without the crinkly bits.

Buffer out, and the crinkley bits get melted away. But now the island is too big. So buffer inwards.

And now we have something we can use. We could now even run ST_Simplify on this result to drop some unneeded vertices and make it smaller yet.

Looking closer, you can see how we have melted away all the crinkley bits while still following the original (mostly). Note that the new shape is still a strict superset of the original.

9 comments:
I really like the simplicity of this solution and it uses tools that are readily available in most GIS software.
FYI, this is known as erosion and dilation -- pretty standard morphology operations in image processing to reduce noise (well, technically not noise - rather, to make the image look like something more canonical, e.g. for OCR work).
-mpg
So simple, yet so effective!
Thanks Paul.
Warren
Awesome trick! Thanks for sharing! :-)
Goodbye Saanich Peninsula! Nice knowing you.
I used Mapshaper for generalizing the BC coast a few days ago: http://mapshaper.org/
I thought Slartibartfast only did Norway. Am I mistaken?
Cheers
Hi,
Could you comment on the time complexity differences between a pair of buffer operations vs. a "topology preserving" simplification? Both are relatively expensive operations for polygons with large numbers of segments...
Thanks
Ben
Apparently I'm the second commenter that specifically needed to simplify Vancouver Island. Thanks for the tip, and for your choice of examples.
@Benjamin. "TopologyPreservingSimplification" and this approach are apples and oranges. The former will weed vertices and avoid cases that cause invalidity (ring crossings, hole collapse), and it won't do things like remove the Saanich Inlet, only make it very very simple (like a V). The dilation/erosion actually removes features (inlets, lakes, etc) and smooths lines. The cost is almost certainly higher for the dilation/erosion method.
Post a Comment