ST_IsCollection

更新时间:
复制 MD 格式

Tests if a geometry is a geometry collection type.

Syntax

boolean ST_IsCollection(geometry g);

Parameters

ParameterDescription
gThe geometry object to test.

Description

ST_IsCollection returns true for the following geometry types:

  • GeometryCollection

  • MultiPoint

  • MultiLineString

  • MultiCurve

  • MultiSurface

  • MultiCompoundCurve

  • Polygon

This function checks the geometry type, not its contents. It returns true for empty collections.

Additional behavior:

  • Supports 3D geometries and preserves Z coordinates.

  • Supports circular strings and curves.

Examples

MULTIPOINT (returns `true`)

SELECT ST_IsCollection('MULTIPOINT((1 0),(2 0))'::geometry);
 st_iscollection
-----------------
 t
(1 row)

GeometryCollection (returns `true`)

SELECT ST_IsCollection('GeometryCollection(POINT(1 0),POLYGON((1 0,2 0, 0 2,1 0)))'::geometry);
 st_iscollection
-----------------
 t
(1 row)