This topic describes the ST_IsValidReason function. This function returns the text that states whether the input geometry object is in a valid format. If not, the text states the reasons.
Syntax
boolean ST_IsValidReason(geometry geomA);
boolean ST_IsValidReason(geometry geomA , integer flags);
Parameters
Parameter | Description |
---|---|
geomA | 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
This function can be used with the ST_IsValid function to generate a detailed report of invalid geometry object and reasons.
Examples
SELECT ST_IsValidReason('POLYGON((0 0,0 1,1 0,1 1,0 0))'::geometry);
st_isvalidreason
----------------------------
Self-intersection[0.5 0.5]
(1 row)