ST_CONVEXHULL()
All functions > GEOSPATIAL > ST_CONVEXHULL()
Returns the convex hull of a geometry.
Signatures
Convex hull
Returns: Convex hull; sub kind depends on input (Point → Point, collinear → LineString, otherwise → Polygon)
ST_CONVEXHULL(geo: T) → GEOMETRY sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo | T | Yes | Geometry value |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY
Signature notes:
- The vertex layout of the result (start vertex, ring orientation, order of parts) is engine-defined: compare two results with ST_EQUALS, not their WKT
- GEOMETRY only: GEOGRAPHY has no spherical form here; convert with ST_TOGEOMETRY for a planar answer
- Single Point returns the same Point
- Collinear points return a LineString
- Returns NULL if the input is NULL
Availability
| Status | Backends |
|---|---|
| Available | duckdb, postgres, trino, databricks, serving |
Examples
FeatureQL
RETURN
-- Convex hull of three points
f1 := ST_ASTEXT(
ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT ((0 0), (1 0), (0 1))'))
)
;Result
| f1 VARCHAR |
|---|
| POLYGON ((0 0, 0 1, 1 0, 0 0)) |
On this page