# Removing Complexities

22 Nov 2010My co-worker 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.