給定一個Geometry對象的集合,返回由相連組件構成的結果數組。

語法

geometry[]  ST_ClusterIntersecting(geometry set  g);

參數

參數名稱 描述
g 目標Geometry數據集。

描述

返回一個GeometryCollections數組,其中每個GeometryCollection代表一組互連的幾何體。

示例

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)