May 2017
Beginner to intermediate
328 pages
7h 17m
English
The first step is to check the validity of input geometries. PostGIS will refuse to convert invalid geometries to topology elements, so it's very important to fix them or filter them out. We will use the ST_IsValidReason and ST_IsValid functions that we learned in Chapter 1, Importing Spatial Data:
SELECT ST_IsValidReason(geom) FROM countries WHERE ST_IsValid(geom) = FALSE;
Luckily, in this case the query returned 0 rows, meaning that all geometries are valid, so we can proceed to the next step.
Read now
Unlock full access