Returns the center point and radius of the minimum bounding circle of a geometry.
Syntax
(geometry, double precision) ST_MinimumBoundingRadius(geometry geom);Parameters
| Parameter | Description |
|---|---|
geom | The input geometry. |
Return value
Returns a composite record with two fields:
| Field | Type | Description |
|---|---|---|
center | geometry | The center point of the minimum bounding circle. |
radius | double precision | The radius of the minimum bounding circle. |
Description
ST_MinimumBoundingRadius computes the center point and radius of the minimum bounding circle — the smallest circle that fully contains the input geometry.
To get the minimum bounding circle of a set of geometries, combine it with ST_Collect.
Examples
The following example computes the minimum bounding circle of a diamond-shaped polygon:
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)The center is at the origin (0, 0) and the radius is 1.
See also
ST_Collect — aggregates geometries into a geometry collection
该文章对您有帮助吗?