Name

ST_IsRing — Tests if a LineString is a ring

Synopsis

boolean ST_IsRing(bytea LineString);

Alias

IsRing

Description

Tests if an LineString is a ring. Returns TRUE if LineString. It is ring if is closed and simple. Returns null if the input geometry is not a LineString.

In a closed LineString the StartPoint and EndPoint are the same Point.

A simple LineString does not pass through the same Point more than once.

Coordinate Dimensions
2D3DM

-

-

Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
2.1.5.17.2.12.17.2.10.27.1.6

Examples

SELECT ST_IsRing(G1),ST_IsClosed(G1),ST_IsSimple(G1) 
 FROM (SELECT ST_GeomFromText('LINESTRING (20 20, 50 20, 50 50, 20 50, 20 20)') as G1) as foo;

 st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
 t         | t           | t
(1 row)

SELECT ST_IsRing(G2),ST_IsClosed(G2),ST_IsSimple(G2) 
 FROM (SELECT ST_GeomFromText('LINESTRING (20 20, 50 20, 20 50, 50 50, 20 20)') as G2) as foo;

 st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
 f         | t           | f
(1 row)

Ring (closed and simple)

Not a Ring (Closed but not simple)

Related functions

ST_IsClosed, ST_IsSimple