Blog

Removing Complexities

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?

Original Island

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.

Buffered by 4km

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

Negative Buffer by 4km

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.

Simple Island

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.

Saanich Peninsula

5 Responses to “Removing Complexities”

  1. Jan Roggisch Says:

    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!

  2. Bill Dollins Says:

    Very handy tip, Paul. Thank you!

  3. [...] This post was mentioned on Twitter by OpenGeo, fernandoquadro, geolibro, Emilie Laffray, Ian Turton and others. Ian Turton said: RT @OpenGeo: Removing complexities with PostGIS, another tip from @pwramsey: http://bit.ly/fkpBZW [...]

  4. Trent Says:

    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

  5. Thomas Knudsen Says:

    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.

Leave a Comment