Skip to content

ST_ConvexHull_Agg

An aggregate function that returns the convex hull of all geometries in a group.

Usage

geometry ST_ConvexHull_Agg(geom: geometry)

Arguments

  • geom (geometry): Input geometry

Description

An aggregate function that computes the smallest convex polygon enclosing all points across every geometry in a group.

Examples

SELECT ST_ConvexHull_Agg(geom) FROM (
    VALUES
        (ST_Point(0, 0)),
        (ST_Point(0, 1)),
        (ST_Point(1, 0)),
        (ST_Point(1, 1))
) AS t(geom);
┌────────────────────────────────┐
│    st_convexhull_agg(t.geom)   │
│            geometry            │
╞════════════════════════════════╡
│ POLYGON((0 0,0 1,1 1,1 0,0 0)) │
└────────────────────────────────┘