This topic describes the ST_IsValid function. This function checks whether a geometry object returned by the ST_Geometry function is in a valid format.
Syntax
boolean ST_IsValid(geometry g);
boolean ST_IsValid(geometry g , integer flags);
Parameters
Parameter | Description |
---|---|
g | The geometry object that you want to specify. |
flags | The bitfield that you want to specify. If you specify this parameter to 1, the self-intersection ring forming a hole is considered to be valid. This is the Environmental Systems Research Institute (ESRI) flag. |
Description
If the input geometry object is invalid, this function provides details about the invalid object.
Examples
SELECT ST_IsValid('POLYGON((0 0,0 1,1 0,1 1,0 0))'::geometry);
NOTICE: Self-intersection at or near point 0.5 0.5
st_isvalid
------------
f
(1 row)