Skip to content
🎉 Apache Sedona 1.8.1 is now available! Check out the new features and improvements.

ST_MinimumClearance

Introduction: The minimum clearance is a metric that quantifies a geometry's tolerance to changes in coordinate precision or vertex positions. It represents the maximum distance by which vertices can be adjusted without introducing invalidity to the geometry's structure. A larger minimum clearance value indicates greater robustness against such perturbations.

For a geometry with a minimum clearance of x, the following conditions hold:

  • No two distinct vertices are separated by a distance less than x.
  • No vertex lies within a distance x from any line segment it is not an endpoint of.

For geometries with no definable minimum clearance, such as single Point geometries or MultiPoint geometries where all points occupy the same location, the function returns Double.MAX_VALUE.

Format: ST_MinimumClearance(geometry: Geometry)

SQL Example

SELECT ST_MinimumClearance(
        ST_GeomFromWKT('POLYGON ((65 18, 62 16, 64.5 16, 62 14, 65 14, 65 18))')
)

Output:

0.5