ST_Collect_Agg¶
Combines multiple geometries from a set of rows into a single collection.
Usage¶
geometry ST_Collect_Agg(geom: geometry)
Arguments¶
- geom (geometry): Input geometry
Description¶
An aggregate function that collects multiple geometries into a single GeometryCollection or the appropriate Multi-type if all inputs share the same geometry type.
Examples¶
SELECT ST_Collect_Agg(geom) AS collected_points
FROM (
VALUES
(ST_Point(-122.4194, 37.7749)),
(ST_Point(-118.2437, 34.0522)),
(ST_Point(-122.6765, 45.5231))
) AS cities(geom);
┌─────────────────────────────────────────────────────────────────────────┐
│ collected_points │
│ geometry │
╞═════════════════════════════════════════════════════════════════════════╡
│ MULTIPOINT((-122.4194 37.7749),(-118.2437 34.0522),(-122.6765 45.5231)) │
└─────────────────────────────────────────────────────────────────────────┘