Skip to content

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)

Arguments

  • geom (geometry): Input geometry

Description

An aggregate function that computes the collective bounding box (envelope) of all geometries in a group.

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)) │
└──────────────────────────────────┘