The steps you need to perform to complete this recipe are as follows:
- First, investigate whether or not any geometry is invalid in the imported table. As you can see in the following query, using the ST_IsValid and ST_IsValidReason functions, we find four invalid geometries that are all invalid for the same reason—ring self-intersection:
postgis_cookbook=# SELECT gid, name, ST_IsValidReason(the_geom) FROM chp03.countries WHERE ST_IsValid(the_geom)=false;
(4 rows)
- Now concentrate on just one of the invalid geometries, for example, in the multipolygon geometry representing Russia. Create a table containing just the ring ...