5. Geospatial Functions : IsClosed
 
Share this page                  
IsClosed
ISCLOSED(g Geometry)
Alias: ST_ISCLOSED
Returns 1 if the first and last points in g are the same; returns 0 otherwise. Use for linestrings to determine if they qualify to be a polygon.
Result type: integer
Examples:
SELECT ISCLOSED(LINEFROMTEXT('LINESTRING(0 0, 0 2, 2 2, 2 4, 4 4, 4 6, 6 6, 6 8, 8 8, 8 10, 10 10)'));
-------------
col1
-------------
0
-------------
SELECT ISCLOSED(LINEFROMTEXT('LINESTRING(0 0, 0 10, 10 10, 0 0)'));
-------------
col1
-------------
1
-------------