Returns the smallest convex hull of the input geometry objects. The convex hull is analogous to stretching a rubber band around the input geometry—it forms the tightest possible convex boundary around all points.
Syntax
geometry ST_ConvexHull(geometry geomA);Parameters
| Parameter | Description |
|---|---|
geomA | The input geometry object. |
Usage notes
This function is different from the ST_ConcaveHull function. In most cases, this function is used to determine an affected area based on a set of observation points for an input MULTI object or GeometryCollection object.
This function supports 3D objects and preserves Z coordinates.
Examples
Compute the convex hull of a multipolygon
The following query computes the convex hull of a MULTIPOLYGON and returns it alongside the original geometry for comparison:
SELECT ST_ConvexHull(g), g
FROM (
SELECT 'MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)),((0 6,6 3,6 6,0 6)))'::geometry AS g
) AS test;The left image shows the input geometry; the right image shows its convex hull.


What's next
ST_ConcaveHull: Computes a concave hull, which is analogous to shrink-wrapping the geometry rather than wrapping it with a rubber band.