Was this helpful?
IsRing
ISRING(g Geometry)
Alias: ST_ISRING
Returns 1 if the start point and end point of g are the same (ISCLOSED) and g does not cross the same point twice (ISSIMPLE). Returns 0 otherwise. Use for linestrings.
Result type: integer
Examples:
g does not cross itself and has the same start and end points:
SELECT ISRING(LINEFROMTEXT('LINESTRING(0 5, 5 10, 10 5, 5 0, 0 5)'));
-------------
col1
-------------
1
-------------
 
g crosses itself:
SELECT ISRING(LINEFROMTEXT('LINESTRING(0 0, 10 0, 10 10, 5 10, 5 6, 7 6, 7 8, 0 8, 0 0)'));
-------------
col1
-------------
0
-------------
Last modified date: 12/14/2023