ST_CollectionHomogenize

更新时间:
复制 MD 格式

Returns the simplest geometry representation of a GeometryCollection.

Syntax

geometry ST_CollectionHomogenize(geometry collection);

Parameters

ParameterDescription
collectionThe input GeometryCollection.

Description

  • If the collection contains a collection of singleton objects, the function returns a singleton object.

  • If the collection contains multiple geometries of the same type, the function returns the equivalent MULTI geometry type.

Examples

SELECT ST_AsText(ST_CollectionHomogenize(ST_GeomFromText('GEOMETRYCOLLECTION(LINESTRING(1 1,2 1),LINESTRING(2 1,2 2))')));

Output:

              st_astext
--------------------------------------
 MULTILINESTRING((1 1,2 1),(2 1,2 2))
(1 row)