May 2017
Beginner to intermediate
328 pages
7h 17m
English
There are three PostGIS functions for checking validity. The first one is the ST_IsValid function. It behaves exactly like ST_IsSimple: it accepts a geometry and returns a Boolean indicating whether the input is valid or not.
SELECT * FROM data_import.ne_110m_land WHERE ST_IsValid(geom) = FALSE;
But what's exactly wrong with returned geometries? PostGIS can return the details of a validity check. Those can be returned in two variants: as a human readable summary or a compound type that includes the summary and location in geometry format. The first variant is named ST_IsValidReason:
SELECT ST_IsValidReason(geom) FROM data_import.ne_110m_land WHERE ST_IsValid(geom) = FALSE;
It returns a summary of test results:
Read now
Unlock full access