ST_MaximumInscribedCircle

Name

ST_MaximumInscribedCircle — Computes the largest circle that is fully contained within a geometry.

Synopsis

(geometry, geometry, double precision) ST_MaximumInscribedCircle ( geometry geom ) ;

Description

Finds the largest circle that is fully contained within a geometry. Returns a record with the center point of the circle, a point on the geometry that is nearest to the center, and the radius of the circle.

For polygonal inputs, the circle is inscribed within the external ring, using the internal rings as boundaries. For linear and point inputs, the circle is inscribed within the convex hull of the input, using the input as further boundaries.

Availability: 3.1.0 - requires GEOS >= 3.9.0.

Examples

SELECT radius, ST_AsText(center) AS center, ST_AsText(nearest) AS nearest
    FROM ST_MaximumInscribedCircle('POLYGON ((50 50, 150 50, 150 150, 50 150, 50 50))')

 radius |     center     |    nearest
--------+----------------+---------------
     50 | POINT(100 100) | POINT(100 50)

Maximum inscribed circle of a triangle polygon. Center, nearest point, and radius are returned.

Maximum inscribed circle of a multi-linestring. Center, nearest point, and radius are returned.