[geos-devel] RE: GEOS errors from PostGIS

James.Sewell at lisasoft.com James.Sewell at lisasoft.com
Tue Jan 11 21:23:01 EST 2011


Sorry, I didn't include the actual error:

An example is:

NOTICE: TopologyException: found non-noded intersection between LINESTRING (143.861 -36.881, 143.861 -36.881) and LINESTRING (143.861 -36.881, 143.861 -36.881) at 143.861 -36.881

This particular one is a two very small identical lines, this isn't always the case but seems to be the majority of the time.

Cheers,
James Sewell
Developer
LISAsoft
________________________________
Ph: +61 3 8680 3250 Fax: +61 3 8680 3299
Level 9, 601 Bourke St, Melbourne Vic 3000
________________________________

LISAsoft is part of the A2end Group of Companies
http://www.ardec.com.au<http://www.ardec.com.au/>
http://www.lisasoft.com<http://www.lisasoft.com/>
http://www.terrapages.com<http://www.terrapages.com/>

From: James.Sewell at lisasoft.com
Sent: Wednesday, 12 January 2011 12:06 PM
To: 'geos-devel at lists.osgeo.org'
Subject: GEOS errors from PostGIS

Hello All,

I am currently creating an OSS Python app which uses PostGIS (and thus GEOS) to combines multiple layers and carries through attributes.

I am using a method derived from Paul Ramsey's http://s3.opengeo.org/postgis-power.pdf document. The steps I am taking are as follows:


*         Take the left and right layers and split them into smaller segments

*         Iterate through the segments doing the following:

o   Use the following to dump each side to linework


SELECT ST_Collect(a.the_geom) AS the_geom
                            FROM (SELECT
                                (ST_Dump
                                (ST_Exteriorring(
                                (ST_Dumprings(
                                (ST_Dump(the_geom)).geom)).geom))).geom AS the_geom


o   Put two resulting multi-polygons into a table, make sure they are valid (and all encapsulated polys are valid),  and union to remove overlap as follows

SELECT ST_Union(ST_snaptogrid(the_geom,10E-10)) AS the_geom


o   Build the polygons back up as follows

SELECT a.the_geom AS the_geom,
                                ST_pointonsurface(a.the_geom) AS point,
                                0 AS leftgid, 0 AS rightgid
FROM (SELECT (ST_Dump(ST_polygonize(the_geom))).geom AS the_geom



o   Then use an overlay to map the attributes back through from the left and the right.


The process works, however I am getting problems with GEOS Non Noded Intersection ("GEOS union() threw an error!") crashes in some areas. These can often be fixed by rearranging the data (importing in a different order, snapping to a slightly different grid etc...).

When a failure occurs I am given two linestrings and a point, however these usually bear no relationship to the lines in either the expected output, the left or the right side other than being in the same area.

Unfortunately I can't provide data at the moment as any attempt to reduce the size of the dataset seems to remove (or relocate) the problem. I will try and get permission to release some data from the customer, but this will take some time.

One thing to note is that the layers I am combining contain very complex and very similar linework. It would not be unexpected to get 10 sets of similar but not identical linework all running around an area. This is acceptable for the end product, but I am wondering if it is upsetting the Union somehow?

If anyone has any ideas they would be most appreciated.




Cheers,
James Sewell
Developer
LISAsoft
________________________________
Ph: +61 3 8680 3250 Fax: +61 3 8680 3299
Level 9, 601 Bourke St, Melbourne Vic 3000
________________________________

LISAsoft is part of the A2end Group of Companies
http://www.ardec.com.au<http://www.ardec.com.au/>
http://www.lisasoft.com<http://www.lisasoft.com/>
http://www.terrapages.com<http://www.terrapages.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20110112/72af7385/attachment-0001.html


More information about the geos-devel mailing list