Niklas Thank you very much for the offered solution. In my case it solves my problem with a very tiny buffer distance below the accuracy of my data. Regrads Horst
------------------------------------------------ Dr. Horst Düster Stv. Amtschef / GIS-Koordinator Kanton Solothurn Bau- und Justizdepartement Amt für Geoinformation SO!GIS Koordination Rötistrasse 4 CH-4501 Solothurn Telefon ++41(0)32 627 25 32 Telefax ++41(0)32 627 22 14 mailto:[email protected] http://www.agi.so.ch -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Gesendet am: Mittwoch, 16. September 2009 10:23 An: PostGIS Users Discussion Betreff: Re: [postgis-users] st_intersection error Hallo Horst The precision problem is not the vertexes that they have in common. They are exactly the same. The problem is that extra vertex that only appears in one of the lines. It will still not be exactly on the line. I think the best solution is to use a thin buffer sile select st_intersection(a.the_geom, st_buffer(b.the_geom,0.00001)), a.myid from aline1 as a, aline2 as b One problem here might be that, as st_buffer works today you will probably get an extra vertex in start and end of your resulting linestring very close to the original vertexes because the buffer will cause an intersection buffered in all directions (new possibilities in 1.5 to avoid that :-) ) Or actually in your case you will only get that extra vertex on the west part because there the line 1 changes direction. On the east side the vertex is just moved a little bit. Hope that helps Nicklas 2009-09-16 Düster Horst wrote: > Martin, Nicklas >> Thank you for your responses. To avoid precision problems I modified my query to: >> select st_intersection(st_snaptogrid(a.the_geom,0.01), st_snaptogrid(b.the_geom,0.01)), a.myid >from aline1 as a, aline2 as b >> As the result I do get a MULTIPOINT geometry with three points. These points are exactly the vertex points of my expected LINESTRING geometry. Why not a LINESTRING? >> Regards >Horst >> ------------------------------------------------ >> Dr. Horst Düster >Stv. Amtschef / GIS-Koordinator >> Kanton Solothurn >Bau- und Justizdepartement >Amt für Geoinformation >SO!GIS Koordination >Rötistrasse 4 >CH-4501 Solothurn >> Telefon ++41(0)32 627 25 32 >Telefax ++41(0)32 627 22 14 >> mailto:[email protected] >www.agi.so.ch >> -----Ursprüngliche Nachricht----- >Von: Martin Davis [mailto:[email protected]] >Gesendet am: Dienstag, 15. September 2009 17:54 >An: PostGIS Users Discussion; Martin Davis >Betreff: Re: [postgis-users] st_intersection error >> Same result in JTS. >> As Nicklas points out, this is a problem of precision. The software is >working as designed, but it's not designed to use it to perform >intersections with a tolerance. >> Some more sophisticated approach is required, such as vertex snapping >the lines to a given tolerance, or perhaps using a narrow buffer and >some sort of segment-based containment tests. >> strk wrote: >> On Tue, Sep 15, 2009 at 11:32:48AM +0200, Düster Horst wrote: >> >>> strk >>> >>> I attached the geometries in my initial mail. >>> >>> Take a look at aline1.sql and aline2.sql >>> >> >> I confirm a POINT and a LINESTRING in a COLLECTION >> is returned by ST_Intersection() with latest version: >> >> POSTGIS="1.5.0SVN" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.0, 21 Dec 2007" USE_STATS >> >> Martin, how about JTS ? >> >> --strk; >> >> Free GIS & Flash consultant/developer () ASCII Ribbon Campaign >> http://foo.keybit.net/~strk/services.html /\ Keep it simple! >> >> >> -- >Martin Davis >Senior Technical Architect >Refractions Research, Inc. >(250) 383-3022 >> _______________________________________________ >postgis-users mailing list >[email protected] >postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
