Name

ST_CollectionHomogenize — Given a geometry collection, returns the "simplest" representation of the contents.

Synopsis

geometry ST_CollectionHomogenize(geometry collection);

Description

Given a geometry collection, returns the "simplest" representation of the contents. Singletons will be returned as singletons. Collections that are homogeneous will be returned as the appropriate multi-type.

[Warning]

When specifying 3 == POLYGON a multipolygon is returned even when the edges are shared. This results in an invalid multipolygon for many cases such as applying this function on an ST_Split result.

Availability: 2.0.0

Examples

  SELECT ST_AsText(ST_CollectionHomogenize('GEOMETRYCOLLECTION(POINT(0 0))'));	

	st_astext
	------------
	 POINT(0 0)
	(1 row)

  SELECT ST_AsText(ST_CollectionHomogenize('GEOMETRYCOLLECTION(POINT(0 0),POINT(1 1))'));	

	st_astext
	---------------------
	 MULTIPOINT(0 0,1 1)
	(1 row)

				

See Also

ST_Multi, ST_CollectionExtract