ST_CollectionHomogenize returns the simplest representation of the content of a GeometryCollection.
Syntax
geometry ST_CollectionHomogenize(geometry collection);Parameters
| Parameter | Description |
|---|---|
collection | The geometry object that you want to specify. |
Description
The function processes input geometry as follows:
Singleton collection: A collection containing a single atomic element is returned as that atomic element.
Homogeneous collection: A collection of the same geometry type is returned as the corresponding MULTI type (for example, MULTILINESTRING).
Examples
Homogeneous collection converted to a MULTI geometry
A collection of two LINESTRINGs is returned as a MULTILINESTRING.
SELECT ST_AsText(
ST_CollectionHomogenize(
ST_GeomFromText('GEOMETRYCOLLECTION(LINESTRING(1 1,2 1),LINESTRING(2 1,2 2))')
)
); st_astext
--------------------------------------
MULTILINESTRING((1 1,2 1),(2 1,2 2))
(1 row)