ST_COLLECT()

All functions > GEOSPATIAL > ST_COLLECT()

Combines two geometries or geographies into a collection without dissolving boundaries.

Signatures

Collect

Returns: A geometry collection containing both inputs

ST_COLLECT(geo1: T, geo2: T) → GEOM_MULTIANY or GEOG_MULTIANY
sql
ParameterTypeRequiredDescription
geo1TYesFirst geometry or geography
geo2TYesSecond geometry or geography

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY

Signature notes:

  • Unlike ST_UNION, does not dissolve shared boundaries; inputs are kept as separate sub-geometries
  • On BigQuery, Trino, and DataFusion: transpiled to ST_Union (no native collect; boundaries may be dissolved)
  • Both inputs must be the same type family
  • Returns NULL if either input is NULL

Examples

FeatureQL
SELECT
    f1 := ST_ASTEXT(ST_COLLECT(ST_GEOMPOINT(0.0, 0.0), ST_GEOMPOINT(1.0, 1.0))) -- Collect two points into a MultiPoint
;
Result
f1 VARCHAR
MULTIPOINT (0 0, 1 1)

Last update at: 2026/05/26 17:22:09