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.

See Also

ST_MinimumBoundingCircle

Examples

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

SELECT radius, ST_AsText(center) AS center, ST_AsText(nearest) AS nearest
    FROM ST_MaximumInscribedCircle(
        'POLYGON ((40 180, 110 160, 180 180, 180 120, 140 90, 160 40, 80 10, 70 40, 20 50, 40 180),
        (60 140, 50 90, 90 140, 60 140))');

     radius      |           center           |    nearest
-----------------+----------------------------+---------------
 45.165845650018 | POINT(96.953125 76.328125) | POINT(140 90)

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

See Also

ST_Collect, ST_MinimumBoundingRadius