I have been trying to peform an ArcGIS-like erase in postgis (see example query at end of post).
However when I try to union all features in one table in preparation for a difference operation with another table I receive the following message of doom and despair: ERROR: GEOSUnaryUnion: TopologyException: found non-noded intersection between LINESTRING (3.09895e+06 1.01068e+07, 3.09896e+06 1.01068e+07) and LINESTRING (3.09896e+06 1.01068e+07, 3.09896e+06 1.01068e+07) at 3098955.3520329543 10106778.227583764 I have tested my geometry for invalid polygons, ran st_makevalid and even tried the buffer 0 trick, but to no avail. If I do st_buffer(geom,.01) I manage to get through the operation with no errors, but I have to alter all of the geometries, not just the geometries in question -and I would rather not even do the latter if at all possible so that I don't change my geometries. I would like to post a bug for this problem, but I know that the exception-throwing features are required to diagnose the problem. However in a dataset of 200,000 geometries it is impossible to know which features are causing the issue as the aforementioned error message gives no indication. I am wondering how I should go about capturing the geometries that cause the error in order to file a bug so that this issue can hopefully be easily resolved and I can move on with my work. If this is not feasible, does anyone know of any work-arounds to pre-prepare valid geometries so that they will not throw these types of errors? My version of postgis is as follows: POSTGIS="2.0.1SVN r9761" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.1, released 2012/05/15" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER The geometries that fail are probably very tiny slivers if that helps with a diagnosis. Thanks, THX1138 ================================================================================ Example table structure: CREATE TABLE features( feature_id serial primary key, feature_geom geometry(multipolygon,2277) ); CREATE TABLE erase_features( erase_id serial primary key, feature_id integer, erase_geom geometry(multipolygon,2277) ); ===================================query========================================= SELECT st_multi(st_difference(a.feature_geom,b.unioned_erase_geom)) FROM features a, (SELECT erase_id, st_multi(st_union(erase_geom)) unioned_erase_geom FROM erase_features GROUP BY erase_id) b WHERE (a.feature_id = b.feature_id) and st_intersects(a.feature_geom,b.unioned_erase_geom) -- View this message in context: http://postgis.17.n6.nabble.com/Troubleshooting-topology-exception-errors-in-large-datasets-tp4999035.html Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users