This topic describes the ST_CollectionHomogenize function. This function returns the simplest representation of the content of a GeometryCollection object.

Syntax

geometry  ST_CollectionHomogenize(geometry  collection);

Parameters

Parameter Description
collection The geometry object that you want to specify.

Description

  • If you specify a collection of singleton objects, the ST_CollectionHomogenize function returns a singleton object.
  • If you specify a collection of homogeneous objects, the ST_CollectionHomogenize function returns a MULTI object.

Examples

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)