Returns the concave hull of one or more geometry objects. Think of a concave hull as shrink-wrap around a set of geometries — it fits more tightly than a convex hull, which behaves more like a rubber band stretched around the outermost points.
Syntax
geometry ST_ConcaveHull(geometry geomA, float targetPercent, boolean allowHoles)
Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
geomA |
geometry | The input geometry object. | — |
targetPercent |
float | The ratio of the concave hull area to the convex hull area. Lower values produce tighter hulls but take longer to compute. | — |
allowHoles |
boolean | Specifies whether to allow holes in the resulting polygon. | false |
Usage notes
Choosing a `targetPercent` value
targetPercent controls the trade-off between precision and performance:
-
Start with
0.99. In some scenarios, this is as fast as computing the convex hull, and the resulting hull is almost always tighter than 99% of the convex hull area. -
Decrease from there to find the best fit. Smaller values increase computation time and the risk of topology exceptions.
-
To reduce output precision after computing, apply
ST_SimplifyPreserveTopology(slower, always returns valid geometry) orST_SnapToGrid(faster, but may return invalid geometry).
Combining with other functions
ST_ConcaveHull is not an aggregate function. To compute the concave hull over a set of geometries, combine it with:
-
ST_Collect— for points, LineString objects, or GeometryCollection objects -
ST_Union— for polygons
Example pattern: ST_ConcaveHull(ST_Collect(somepointfield), 0.80)
Passing invalid geometry objects to ST_ConcaveHull causes the function to fail.
Dimension and input behavior
-
The dimension of the returned hull is never higher than the dimension of the input polygon object.
-
ST_ConcaveHullis primarily used with MULTI and GeometryCollection objects. -
For image recognition and similar spatial analysis tasks,
ST_ConcaveHullencloses all input geometries more precisely than a convex hull.
Examples
Compare targetPercent values
The following query compares the original geometry against concave hulls computed at targetPercent = 0.99 and targetPercent = 0.98.
SELECT g, ST_ConcaveHull(g, 0.99), ST_ConcaveHull(g, 0.98), 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;



Compute a concave hull over a set of points
Use ST_Collect to aggregate point observations before passing them to ST_ConcaveHull.
-- Estimate the affected area based on point observations, grouped by type
SELECT disease_type,
ST_ConcaveHull(ST_Collect(obs_point), 0.99) AS geom
FROM disease_obs
GROUP BY disease_type;
What's next
-
ST_ConvexHull — compute the convex hull of a geometry
-
ST_Collect — aggregate geometries before passing to ST_ConcaveHull
-
ST_Union — merge polygon geometries before computing the hull