ST_IsSimple checks whether a geometry has no points of self-intersection and returns a Boolean result.
Syntax
boolean ST_IsSimple(geometry geomA);Parameters
| Parameter | Description |
|---|---|
geomA | The geometry to check. |
Usage notes
Returns
trueif the geometry is simple; returnsfalseotherwise.Supports 3D geometry and preserves z coordinates.
Examples
The following examples use a LINESTRING geometry to demonstrate when ST_IsSimple returns true and false.
Returns true — no self-intersection:
SELECT ST_IsSimple('LINESTRING(0 0,0 2,2 0,0 0)'::geometry);Output:
st_issimple
-------------
t
(1 row)Returns false — geometry has a self-intersection:
SELECT ST_IsSimple('LINESTRING(0 0,0 2,0 0)'::geometry);Output:
st_issimple
-------------
f
(1 row)