ST_IsClosed

更新时间:
复制 MD 格式

Returns true if a geometry is closed.

Syntax

boolean ST_IsClosed(geometry g)

Parameters

ParameterDescription
gThe geometry to check.

Usage notes

  • For polyhedral surfaces, indicates whether the surface is a closed geometry or an open plane.

  • Supports 3D geometries and preserves z coordinates.

  • Supports polyhedral surfaces.

  • Supports circular strings and curves.

Examples

Check whether a LineString is closed.

Open LineString — start and end points differ, so the function returns false:

SELECT ST_IsClosed('LINESTRING(0 0,0 1)'::geometry);
 st_isclosed
-------------
 f
(1 row)

Closed LineString — start and end points are the same, so the function returns true:

SELECT ST_IsClosed('LINESTRING(0 0,0 1,1 0,0 0)'::geometry);
 st_isclosed
-------------
 t
(1 row)