Skip to content
πŸŽ‰ Apache Sedona 1.9.1 is out now! πŸ—ΊοΈ Geography SQL functions, Box2D & Box3D types, raster Python UDFs & more. Read the release notes β†’

ST_StraightSkeleton

Introduction: Computes the straight skeleton of a polygonal geometry. The straight skeleton is a method of representing a polygon by a topological skeleton, formed by a continuous shrinking process where each edge moves inward in parallel at a uniform speed.

This function uses the weighted straight skeleton algorithm based on Felkel's approach.

This function may have significant performance limitations when processing polygons with a very large number of vertices. For very large polygons (e.g., 10,000+ vertices), applying vertex reduction or simplification is essential to achieve practical computation times.

Outlines traced from raster pixels, or pieces cut by ST_SubDivide, often contain many short, near-collinear edges. These trigger degenerate events in the skeleton algorithm: the call still returns a result, but the skeleton can be degraded around such edges. Simplifying the input first, for example with ST_SimplifyPreserveTopology, avoids this and also reduces computation time.

Format: ST_StraightSkeleton(geom: Geometry)

Return type: Geometry

Since: v1.8.0

Example:

SELECT ST_StraightSkeleton(
  ST_GeomFromWKT('POLYGON ((45 0, 55 0, 55 40, 70 40, 70 50, 30 50, 30 40, 45 40, 45 0))')
)

Output:

MULTILINESTRING ((50 5, 50 45), (50 45, 35 45), (50 45, 65 45), (35 45, 30 45), (35 45, 40 40), (65 45, 70 45), (65 45, 60 40), (50 5, 45 5), (50 5, 55 5))

ST_StraightSkeleton