24

I have a dataset of building footprints vectorised from a raster dataset. The dataset is currently just a vector representation of the raster data. I would like a polygon dataset that only has vertices at the corners of the building. I have attempted to use the Simplify command in PostGIS with limited success.

Is there a better way?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Matthew Snape
  • 6,127
  • 2
  • 27
  • 48

3 Answers3

18

There are many algorithms dedicated to building simplification. You may have a look at this website for an overview. See also this question. You could use:

  • Building outline simplification: It consist in recursively deleting too short edges of the outline and lengthening the neighbor edges. Example:

alt text

  • Smallest surrounding rectangle algorithm: It consist in replacing the building geometry by the smallest surrounding rectangle. This rectangle can also be scaled to the building initial area. Example:

alt text

  • Squaring algorithm: It consists in applying a light rotation to edges to make the corners perfectly squared. Example:

alt text

These transformations may be enough for your need. It can be interesting to combine them.

I am almost 100% sure none of these algorithms are implemented in PostGIS. Some are implemented in the Opencarto java library I am developing. Let me know if you want to test it!

julien
  • 10,186
  • 6
  • 55
  • 93
  • 1
    Can you give a short explanation of what algorithms you refer to in Opencarto for the mentioned "Building outline simplification". I couldn't find direct info in the wiki or code in Opencarto. – benjist Sep 09 '16 at 08:51
  • It is "ShortEdgesDeletion". You can find it on github there: https://github.com/jgaffuri/OpenCarto/blob/master/src/main/java/org/opencarto/algo/polygon/ShortEdgesDeletion.java – julien Sep 12 '16 at 07:48
  • Link update: https://github.com/jgaffuri/OpenCarto/blob/gh-pages/src/main/java/org/opencarto/algo/polygon/ShortEdgesDeletion.java – julien Jan 24 '18 at 13:52
4
geometry ST_SimplifyPreserveTopology(geometry geomA, float tolerance);

Will avoid creating derived geometries (polygons in particular) that are invalid http://www.postgis.org/documentation/manual-1.5SVN/ST_SimplifyPreserveTopology.html

should be a better output than Simplify

check your geometry first and after with ST_IsSimple(geometry geomA);

Mapperz
  • 49,701
  • 9
  • 73
  • 132
3

Something like this might do the trick:

"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."

http://blog.opengeo.org/2010/11/22/removing-complexities/

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Regina Obe
  • 10,503
  • 1
  • 23
  • 28
  • that's an interesting approach and it seems relatively effective. Thanks for the pointer, it's something I'll be able to use. Your answer would be better if it contained a simple phrase containing the core idea being referenced and wasn't just a link. – matt wilkie Jan 12 '11 at 00:51