Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Determines whether the geometry is a valid spatial object.
Returns 1 if the geometry value is valid, otherwise 0.
By default, the server does not validate spatial data as it is created or imported from other formats. The ST_IsValid method can be used to verify that the imported data represents a geometry that is valid. Operations on invalid geometries return undefined results.
The following returns the result 0 because the polygon contains a bow tie (the ring has a self-intersection).
SELECT NEW ST_Polygon( 'Polygon(( 0 0, 4 0, 4 5, 0 -1, 0 0 ))' ) .ST_IsValid()
The following returns the result 0 because the polygons within the geometry self-intersect at a surface. Self-intersections of a geometry collection at finite number of points is considered valid.
SELECT NEW ST_MultiPolygon( 'MultiPolygon((( 0 0, 2 0, 1 2, 0 0 )),((0 2, 1 0, 2 2, 0 2)))' ) .ST_IsValid()