5. Geospatial Functions : IsSimple
 
Share this page                  
IsSimple
ISSIMPLE(g Geometry)
Alias: ST_ISSIMPLE
Returns 1 if g does not cross the same point twice; returns 0 if it does. g is simple even if its start and end point are the same. Returns -‑ if there is an error.
Result type: integer
Examples:
One line of g touches another point in g.
SELECT ISSIMPLE(LINEFROMTEXT('LINESTRING(5 0, 10 10, 10 0, 0 0, 10 10)'));
-------------
col1
-------------
0
-------------
One line of g crosses over another line:
SELECT ISSIMPLE(LINEFROMTEXT('LINESTRING(0 0, 10 10, 10 0, 0 10, 0 0)'));
-------------
col1
-------------
0
-------------
g does not cross the same point twice:
SELECT ISSIMPLE(LINEFROMTEXT('LINESTRING(10 20, 0.5 13.1, 4.1 1.9, 15.9 1.9, 19.5 13.1, 10 20)'));
-------------
col1
-------------
1
-------------