ST_MinimumBoundingRadius

更新时间:
复制 MD 格式

Returns the center point and radius of the minimum bounding circle that encloses the input geometry object.

Syntax

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

Parameters

ParameterDescription
geomThe geometry object to compute the minimum bounding circle for.

Return value

Returns a composite row with two fields:

FieldTypeDescription
centergeometryThe center point of the minimum bounding circle.
radiusdouble precisionThe radius of the minimum bounding circle.

Usage notes

Use ST_MinimumBoundingRadius with ST_Collect to compute the minimum bounding circle of a set of geometry objects.

Examples

The following example computes the minimum bounding circle of a diamond-shaped polygon. The result shows the center point and radius of the circle.

SELECT ST_AsText(center), radius
FROM ST_MinimumBoundingRadius('POLYGON((0 1,-1 0,0 -1,1 0,0 1))'::geometry);

Output:

 st_astext  | radius
------------+--------
 POINT(0 0) |      1
(1 row)