[geos-devel] RE: GEOS errors from PostGIS
James.Sewell at lisasoft.com
James.Sewell at lisasoft.com
Fri Jan 14 01:28:35 EST 2011
Heya,
The particular error I had in front of me isn't fixed by ST_Union(the_geom, the_geom), but it is fixed by ST_Union(the_geom, ST_SetSRID('LINESTRING EMPTY', 4283)). This is good news (although the errors seem to sometimes occur in different places as I use different methods, cross fingers though).
I am rerunning all my processes to see if there are any other GEOS errors with this method, will let you know after the weekend!
Thanks again for the help.
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: geos-devel-bounces at lists.osgeo.org [mailto:geos-devel-bounces at lists.osgeo.org] On Behalf Of Martin Davis
Sent: Friday, 14 January 2011 5:12 PM
To: geos-devel at lists.osgeo.org
Subject: Re: [geos-devel] RE: GEOS errors from PostGIS
In the case of lines, I think GEOS Unary Union just delegates to union(lines, empty point). So you could try running st_union(lines, empty point) and see if that works.
If this doesn't work, it could just be a case where the snapping heuristic tolerances aren't being set large enough to handle the linework. Or, it could be some other limitation...
If the problem persists, if you can send me a sample dataset (as shapefile or WKB file) which shows the problem, I can try and see if JTS has the same problem and if there's an obvious fix.
Martin
On 1/13/2011 9:54 PM, James.Sewell at lisasoft.com<mailto:James.Sewell at lisasoft.com> wrote:
Thanks Martin,
I'll install the latest nightly build of GEOS, recompile PostGIS and hope for the best.
Reading the thread does that mean that st_union(geom, geom) should work in this case? I had previously done some testing and it didn't seem to, I'll test again though.
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: geos-devel-bounces at lists.osgeo.org<mailto:geos-devel-bounces at lists.osgeo.org> [mailto:geos-devel-bounces at lists.osgeo.org] On Behalf Of Martin Davis
Sent: Friday, 14 January 2011 2:51 PM
To: geos-devel at lists.osgeo.org<mailto:geos-devel at lists.osgeo.org>
Subject: Re: [geos-devel] RE: GEOS errors from PostGIS
James,
I suspect this may be caused by a known bug in the Unary union. This was identified in this thread on the JTS list:
http://sourceforge.net/mailarchive/forum.php?thread_name=4C0FB4A5.2010304%40refractions.net&forum_name=jts-topo-suite-user
I fixed this in JTS, in the soon-to-be-released ver 1.12. Perhaps this fix hasn't made it's way into GEOS and PostGIS yet.
The thing to do is to get this fixed in GEOS, rolled into PostGIS, and then you can retest your union case.
Martin
On 1/11/2011 6:23 PM, James.Sewell at lisasoft.com<mailto:James.Sewell at lisasoft.com> wrote:
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<mailto:James.Sewell at lisasoft.com>
Sent: Wednesday, 12 January 2011 12:06 PM
To: 'geos-devel at lists.osgeo.org<mailto: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:
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
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
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
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/>
_______________________________________________
geos-devel mailing list
geos-devel at lists.osgeo.org<mailto:geos-devel at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/geos-devel
No virus found in this message.
Checked by AVG - www.avg.com<http://www.avg.com>
Version: 10.0.1191 / Virus Database: 1435/3373 - Release Date: 01/11/11
_______________________________________________
geos-devel mailing list
geos-devel at lists.osgeo.org<mailto:geos-devel at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/geos-devel
No virus found in this message.
Checked by AVG - www.avg.com<http://www.avg.com>
Version: 10.0.1191 / Virus Database: 1435/3377 - Release Date: 01/13/11
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20110114/d4c59a5b/attachment-0001.html
More information about the geos-devel
mailing list