ST_IsSimple

Determines if a spatial object does not intersect itself or touch its own boundary at any point.

Determines if a spatial object does not intersect itself or touch its own boundary at any point.

Behavior type

Immutable

Syntax

ST_IsSimple( g )

Arguments

g
Spatial object, type GEOMETRY or GEOGRAPHY

Returns

BOOLEAN

Supported data types

Data Type GEOMETRY GEOGRAPHY (Perfect Sphere)
Point Yes Yes
Multipoint Yes No
Linestring Yes Yes
Multilinestring Yes No
Polygon Yes Yes
Multipolygon Yes No
GeometryCollection No No

Examples

The following examples show how to use ST_IsSimple.

Polygon does not intersect itself:

=> SELECT ST_IsSimple(ST_GeomFromText('POLYGON((-1 2,0 3,1 2,1 -2,-1 2))'));
 ST_IsSimple
--------------
 t
(1 row)

Linestring intersects itself.:

=> SELECT ST_IsSimple(ST_GeographyFromText('LINESTRING(10 10,25 25,26 34.5,
   10 30,10 20,20 10)'));
 St_IsSimple
-------------
 f
(1 row)

Linestring touches its interior at one or more locations:

=> SELECT ST_IsSimple(ST_GeomFromText('LINESTRING(0 0,0 1,1 0,2 1,2 0,0 0)'));
 ST_IsSimple
-------------
 f
(1 row)