[postgis-users] what to do about TopologyExceptions
Peter Hopfgartner
peter.hopfgartner at r3-gis.com
Mon Dec 20 08:49:43 PST 2010
AFAIK there are slightly different definitions of valid polygon between shape files and PostGIS/Simple Features.
Paul Ramsey had a talk on a number of tricks to correct those problems (and some more):
http://2010.foss4g.org/presentations_show.php?id=3369.
Peter Hopfgartner
R3 GIS Srl - GmbH
http://www.r3-gis.com
--------David Kaplan <david.kaplan at ird.fr> wrote--------
Subject: [postgis-users] what to do about TopologyExceptions
Date: 20.12.2010 09:54
>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/
>**********************************
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
More information about the postgis-users
mailing list