ST_MinimumBoundingCircle
What is ST_MinimumBoundingCircle?
ST_MinimumBoundingCircle is a PostGIS function that returns the smallest circle that contains the entire input geometry. The result is a polygon approximating the true circle with a configurable number of vertices per quarter arc.
ST_MinimumBoundingCircle(geometry geomA, integer num_segs_per_qt_circ = 48) → geometryMore segments per quarter circle produce a closer polygonal approximation of the true circle. The default of 48 gives a 192-sided polygon.
When would you use ST_MinimumBoundingCircle?
Use ST_MinimumBoundingCircle to compute a rotation-invariant bounding shape around a feature — bounding a building footprint regardless of its orientation, estimating the size of a cluster of points, or deriving a circular area of influence. It is particularly useful when axis-aligned envelopes (ST_Envelope) are misleading for diagonally-oriented shapes.
1SELECT name, ST_MinimumBoundingCircle(geom) AS bounding_circle
2FROM parks;FAQs
Why use ST_MinimumBoundingCircle instead of ST_Envelope?
ST_Envelope is always axis-aligned, so a long diagonal feature can have a huge envelope relative to its actual extent. ST_MinimumBoundingCircle is rotation-invariant — its area depends only on the geometry's diameter, not its orientation. For rotation-agnostic comparisons, the circle (or ST_OrientedEnvelope) is a much better choice.
Can I get just the radius and centre?
Yes — use ST_MinimumBoundingRadius, which returns a record with the center point and radius. That's cheaper than constructing the polygon and is what you want for non-visual analysis.
How many segments should I request?
The default of 48 per quarter (192 sides total) is visually indistinguishable from a true circle at normal zoom levels. For storage or performance-critical uses, 8–16 per quarter (32–64 sides total) is usually sufficient.
What CRS is the circle computed in?
The circle is computed in the input geometry's Cartesian coordinate space. For lat/lon data the result is an ellipsoidal shape on the ground, not a true geodesic circle — reproject to a metric CRS first if you need real-world circularity.