My colleague Alyssa Wright just asked me an interesting question: Vancouver Island is a pretty crinkley island, how would we simplify it to remove the crinkley bits?

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.

Very nice creative solution. I would have needed that long walk in the snow to figure that one out, but now that I’ve read about it it’ll go straight into my toolbox for future use. Thanks!

Very handy tip, Paul. Thank you!

Pingback: Tweets that mention OpenGeo – Removing Complexities -- Topsy.com

Good summary. This method has been useful to me over the years. But it also reminded me of a related problem for grouping a bunch of tiny polygons into a larger more simplified group. This old 2000 paper described it fairly well. http://www.glims.org/glacierdata/data/lit_ref_files/raup2000.pdf

This is equivalent to the “closing” operation from mathematical morphology (dilation followed by erosion) – cf. http://en.wikipedia.org/wiki/Closing_(morphology)

The mathematical morphological operators are in general extremely powerful tools for preprocessing/simplification of complex imagery as part of a geospatial feature extraction pipeline.