[postgis-users] what to do about TopologyExceptions
David Kaplan
david.kaplan at ird.fr
Mon Dec 20 00:53:53 PST 2010
Hi,
I am working with a GIS table that is derived from importing a fairly
complex shapefile. I want to do a number of union and difference
operations, but I am encountering TopologyException problems and am
wondering how much attention I need to pay to these exceptions and what
is the best way to deal with these problems.
For example, upon doing a simple union operation, I have:
CREATE TABLE by_country_iucn AS
SELECT min(ogc_fid) AS ogc_fid, country, iucn_cat,
ST_Multi( ST_Union( wkb_geometry ) ) AS wkb_geometry
FROM pol_2010
GROUP BY country, iucn_cat
ORDER BY country, iucn_cat;
I get the following exception at the end:
NOTICE: TopologyException: side location conflict at 29.1972 0.251105
However, I am not sure what to do with this for two reasons:
1) The point indicated in the exception (presuming this is a 2D point
location) is located in the middle of nowhere and none of my polygons
come anywhere near it (the nearest is >1000 km away).
2) Looking at the result of the union, I don't see any obvious problems.
Do these exceptions mean I am missing some part of the desired union?
For the union, this returns a result no problem, but for the difference
operations that follow it, the query fails with no result after a
similar exception.
I saw in a previous thread that I should use ST_IsValid to test for
problems. I applied this to my shapefile and it found lots of results.
Looking at the "bad" polygons, many look fine to the naked eye, but some
do have strange things like internal lines. Is there a good way to fix
these? ST_SimplifyPreserveTopology? Will doing this help the other
union and difference manipulations?
Thanks for the help.
Cheers,
David
--
**********************************
David M. Kaplan
Charge de Recherche 1
Institut de Recherche pour le Developpement
Centre de Recherche Halieutique Mediterraneenne et Tropicale
av. Jean Monnet
B.P. 171
34203 Sete cedex
France
Phone: +33 (0)4 99 57 32 27
Fax: +33 (0)4 99 57 32 95
http://www.ur097.ird.fr/team/dkaplan/index.html
http://www.amped.ird.fr/
**********************************
More information about the postgis-users
mailing list