ST_Envelope_Agg¶
An aggregate function that returns the collective bounding box (envelope) of a set of geometries.
Usage¶
geometry ST_Envelope_Agg(geom: geometry)
geometry ST_Envelope_Agg(geog: geography)
Arguments¶
- geog (geography): Input geography
- geom (geometry): Input geometry
Description¶
An aggregate function that computes the collective bounding box (envelope) of all geometries in a group. Geography input is also accepted; the envelope is always returned as a geometry. For geographies that cross the antimeridian, a multi geometry is returned with one polygon each for the west and east component.
Examples¶
SELECT ST_Envelope_Agg(geom) FROM (
VALUES
(ST_Point(0, 0)),
(ST_Point(5, 5)),
(ST_Point(10, 2))
) AS t(geom);
┌──────────────────────────────────┐
│ st_envelope_agg(t.geom) │
│ geometry │
╞══════════════════════════════════╡
│ POLYGON((0 0,0 5,10 5,10 0,0 0)) │
└──────────────────────────────────┘