ST_IsRing — Tests if a LineString is a ring
boolean ST_IsRing(bytea
LineString);
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.
| 2D | 3D | M |
|---|---|---|
![]() | - | - |
| 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.1 | 7.2.12.1 | 7.2.10.2 | 7.1.6 |
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) |