6

I am aware of Finding centrelines from polygons in QGIS? but I am looking for another Open Source GIS way to do this.

Is there a possibility to create centerlines in PostGIS?

I have this shapefile (see below) which contains different zones. I need a centerline in each zone - it may not be one line, it can be more (for example in brown zone).

In ArcGIS I can separate each zone as a new shapefile and then use ET Geowizard to create that lines.

Zones

  • It's not really a duplicate, because this question isn't limited to QGIS... – alphabetasoup Nov 13 '15 at 19:19
  • As it stood I think this question could be read two ways: "It wanted any Open Source GIS" in which case QGIS is open source making it a duplicate, or "it wanted all Open Source GIS options" in which case it would be too broad. To navigate in between I have edited its scope to match its only answer (yours). If the asker is not satisfied with either QGIS or PostGIS answers then they should ask another question about the particular Open Source GIS that they are trying to use. – PolyGeo Nov 15 '15 at 05:49
  • Thanks guys, ST_ApproximateMedialAxis seems to be the solution of my problem. – Tomáš Kudela Nov 19 '15 at 12:14

1 Answers1

6

PostGIS has ST_StraightSkeleton, which implements a polygon thinning algorithm:

ST_StraightSkeleton — Compute a straight skeleton from a geometry

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
alphabetasoup
  • 8,718
  • 4
  • 38
  • 78
  • 2
    Or ST_ApproximateMedialAxis that its doc links to. Seems to create less noisy results. – lynxlynxlynx Nov 13 '15 at 17:52
  • 1
    Note that you need to build PostGIS from sourfce with SFCGAL support to use these functions. You can mirror the behavior with Voronoi polygons. Some read about that available at https://www.safaribooksonline.com/library/view/postgis-cookbook/9781849518666/ch06s06.html – Michal Zimmermann Nov 15 '15 at 07:39