ST_COLLECT
functionsupportedCore SQL functionsThere are two forms of ST_COLLECT: - Scalar: This function combines two GEOGRAPHY objects into one. - Aggregate: This function combines all the GEOGRAPHY objects in a column into one GEOGRAPHY object.
Syntax
Scalar:
ST_COLLECT( <geography_expression_1> , <geography_expression_2> )
Aggregate:
ST_COLLECT( <geography_expression_1> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_expression_1 | required | A GEOGRAPHY object. |
geography_expression_2 | required | A GEOGRAPHY object. |
Returns
The function returns a value of type GEOGRAPHY.
Usage notes
- If g1 and g2 are both Point objects, the result is a MultiPoint object containing the two Points. Similarly, if g1 and g2 are both LineString objects, the result is a MultiLineString object. Etc.
- If g1 and g2 are different types of geospatial objects, or if at least one of the input GEOGRAPHY objects is a collection (e.g. MultiLineString, GeometryCollection, or FeatureCollection), then the result is a GeometryCollection containing both input objects.