This topic describes the ST_ClusterIntersecting function. This function returns an array that consists of GeometryCollection objects, each of which represents an interconnected set of geometry objects.

Syntax

geometry[]  ST_ClusterIntersecting(geometry set  g);

Parameters

ParameterDescription
Parameter Description
g The geometry dataset that you want to specify.

Description

This function returns an array that consists of GeometryCollection objects. Each GeometryCollection object represents an interconnected set of geometry objects.

Examples

SELECT ST_AsText(unnest(ST_ClusterIntersecting(geom)))
    from (select ARRAY['LINESTRING (0 0,0 1)'::geometry,
                     'LINESTRING (0 1,3 3)'::geometry,
                     'POINT (-1 -1)'::geometry] as geom) as test;
                          st_astext
-------------------------------------------------------------
 GEOMETRYCOLLECTION(LINESTRING(0 0,0 1),LINESTRING(0 1,3 3))
 GEOMETRYCOLLECTION(POINT(-1 -1))
(2 rows)