2

I am curious about the internal working of ST_ApproximateMedialAxis(geometry) when a complex polygon is passed to this function.

How does it calculate the medial axis internally?

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
user217087
  • 21
  • 1
  • 1
    Have you consulted its documentation? If so, please link to it, and describe precisely where you expected to find your answer and what, if anything, was there. – PolyGeo Dec 23 '22 at 11:33
  • The medial axis is a point set predicate and its computation rather well defined. PostGIS (GEOS/SFCGAL) does not significantly deviate from the established algorithms. – geozelot Dec 23 '22 at 12:19
  • 2
    There is a story about making one implementation in https://github.com/MapServer/MapServer/wiki/Medial-Axis-Approximation and in the comments of the referred pull request. – user30184 Dec 23 '22 at 14:08
  • See https://gis.stackexchange.com/questions/409483/simplify-a-branching-line-string for a QA related to that PR – Ian Turton Dec 24 '22 at 10:59

1 Answers1

3

The PostGIS ST_ApproximateMedialAxis uses the SFCGAL approximateMedialAxis function (code here). This function computes the straight skeleton using CGAL. It then returns only skeleton edges which are considered to form the medial axis according to the logic in this function.

dr_jts
  • 5,038
  • 18
  • 15