ST_IsSimpleDetail — Report locations of self-intersection or self-tangency, if any.
simple_detail ST_IsSimpleDetail(geometry geom, integer findAllLocations = 0, integer boundaryNodeRule = 1);
Returns a simple_detail row,
containing a boolean (simple) stating if a geometry is simple
and a geometry (location) pointing out where it is non-simple.
The optional findAllLocations parameter can be set to 1 to report all non-simple locations, rather than just one.
The optional boundaryNodeRule values are:
1: OGC-Mod2 - line endpoints are in the Boundary if they occur an odd number of times.
This is the rule defined by the OGC SFS standard, and is the default for ST_Relate.
2: Endpoint - all endpoints are in the Boundary.
3: MultivalentEndpoint - endpoints are in the Boundary if they occur more than once.
In other words, the boundary is all the "attached" or "inner" endpoints (but not the "unattached/outer" ones).
4: MonovalentEndpoint - endpoints are in the Boundary if they occur only once.
In other words, the boundary is all the "unattached" or "outer" endpoints.
Availability: 3.7.0
SELECT ST_IsSimple('POLYGON((1 2,3 4,5 6,1 2))');
f
SELECT ST_IsSimple('LINESTRING(1 1,2 2,2 3.5,1 3,1 2,2 1)');
f