<html>
<head>
        <title></title>
        
<meta name="GENERATOR" content="MSHTML 8.00.6001.18812"></meta>
</head>

<body>
        
<div align="left">Hallo Horst</div>
        
<div align="left"> </div>
        
<div align="left">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.</div>
        
<div align="left"> </div>
        
<div align="left">I think the best solution is to use a thin buffer sile</div>
        
<div align="left"> </div>
        
<div align="left">
                
<div><span style="FONT-SIZE: 10pt">select st_intersection(a.the_geom, st_buffer(b.the_geom,0.00001)), a.myid</span><br />
                        <span style="FONT-SIZE: 10pt">from aline1 as a, aline2 as b</span></div></div>
        
<div align="left"> </div>
        
<div align="left">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 :-) ) </div>
        
<div align="left"> </div>
        
<div align="left">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.</div>
        
<div align="left"> </div>
        
<div align="left">Hope that helps</div>
        
<div align="left">Nicklas</div>
        
<div align="left"> </div>
        
<div align="left">2009-09-16 Düster Horst wrote:<br />
                <br />
                ></div>
        
<div><span style="FONT-SIZE: 10pt">Martin, Nicklas</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">Thank you for your responses. To avoid precision problems I modified my query to:</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">select st_intersection(st_snaptogrid(a.the_geom,0.01), st_snaptogrid(b.the_geom,0.01)), a.myid</span><br />
                ><span style="FONT-SIZE: 10pt">from aline1 as a, aline2 as b</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">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?</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">Regards</span><br />
                ><span style="FONT-SIZE: 10pt">Horst</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">------------------------------------------------</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">Dr. Horst Düster</span><br />
                ><span style="FONT-SIZE: 10pt">Stv. Amtschef / GIS-Koordinator </span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">Kanton Solothurn</span><br />
                ><span style="FONT-SIZE: 10pt">Bau- und Justizdepartement</span><br />
                ><span style="FONT-SIZE: 10pt">Amt für Geoinformation</span><br />
                ><span style="FONT-SIZE: 10pt">SO!GIS Koordination</span><br />
                ><span style="FONT-SIZE: 10pt">Rötistrasse 4</span><br />
                ><span style="FONT-SIZE: 10pt">CH-4501 Solothurn</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">Telefon ++41(0)32 627 25 32</span><br />
                ><span style="FONT-SIZE: 10pt">Telefax ++41(0)32 627 22 14</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">mailto:horst.duester@bd.so.ch</span><br />
                ><span style="FONT-SIZE: 10pt">www.agi.so.ch</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">-----Ursprüngliche Nachricht-----</span><br />
                ><span style="FONT-SIZE: 10pt">Von: Martin Davis [mailto:mbdavis@refractions.net]</span><br />
                ><span style="FONT-SIZE: 10pt">Gesendet am: Dienstag, 15. September 2009 17:54</span><br />
                ><span style="FONT-SIZE: 10pt">An: PostGIS Users Discussion; Martin Davis</span><br />
                ><span style="FONT-SIZE: 10pt">Betreff: Re: [postgis-users] st_intersection error</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">Same result in JTS.</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">As Nicklas points out, this is a problem of precision. The software is </span><br />
                ><span style="FONT-SIZE: 10pt">working as designed, but it's not designed to use it to perform </span><br />
                ><span style="FONT-SIZE: 10pt">intersections with a tolerance.</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">Some more sophisticated approach is required, such as vertex snapping </span><br />
                ><span style="FONT-SIZE: 10pt">the lines to a given tolerance, or perhaps using a narrow buffer and </span><br />
                ><span style="FONT-SIZE: 10pt">some sort of segment-based containment tests.</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">strk wrote:</span><br />
                ><span style="FONT-SIZE: 10pt">> On Tue, Sep 15, 2009 at 11:32:48AM +0200, Düster Horst wrote:</span><br />
                ><span style="FONT-SIZE: 10pt">> </span><br />
                ><span style="FONT-SIZE: 10pt">>> strk</span><br />
                ><span style="FONT-SIZE: 10pt">>></span><br />
                ><span style="FONT-SIZE: 10pt">>> I attached the geometries in my initial mail.</span><br />
                ><span style="FONT-SIZE: 10pt">>></span><br />
                ><span style="FONT-SIZE: 10pt">>> Take a look at aline1.sql and aline2.sql</span><br />
                ><span style="FONT-SIZE: 10pt">>> </span><br />
                ><span style="FONT-SIZE: 10pt">></span><br />
                ><span style="FONT-SIZE: 10pt">> I confirm a POINT and a LINESTRING in a COLLECTION</span><br />
                ><span style="FONT-SIZE: 10pt">> is returned by ST_Intersection() with latest version:</span><br />
                ><span style="FONT-SIZE: 10pt">></span><br />
                ><span style="FONT-SIZE: 10pt">> POSTGIS="1.5.0SVN" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.0, 21 Dec 2007" USE_STATS</span><br />
                ><span style="FONT-SIZE: 10pt">></span><br />
                ><span style="FONT-SIZE: 10pt">> Martin, how about JTS ?</span><br />
                ><span style="FONT-SIZE: 10pt">></span><br />
                ><span style="FONT-SIZE: 10pt">> --strk; </span><br />
                ><span style="FONT-SIZE: 10pt">></span><br />
                ><span style="FONT-SIZE: 10pt">> Free GIS & Flash consultant/developer () ASCII Ribbon Campaign</span><br />
                ><span style="FONT-SIZE: 10pt">> http://foo.keybit.net/~strk/services.html /\ Keep it simple! </span><br />
                ><span style="FONT-SIZE: 10pt">></span><br />
                ><span style="FONT-SIZE: 10pt">> </span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">-- </span><br />
                ><span style="FONT-SIZE: 10pt">Martin Davis</span><br />
                ><span style="FONT-SIZE: 10pt">Senior Technical Architect</span><br />
                ><span style="FONT-SIZE: 10pt">Refractions Research, Inc.</span><br />
                ><span style="FONT-SIZE: 10pt">(250) 383-3022</span></div><br />
        >>
        
<div><span style="FONT-SIZE: 10pt">_______________________________________________</span><br />
                ><span style="FONT-SIZE: 10pt">postgis-users mailing list</span><br />
                ><span style="FONT-SIZE: 10pt">postgis-users@postgis.refractions.net</span><br />
                ><span style="FONT-SIZE: 10pt">postgis.refractions.net/mailman/listinfo/postgis-users</span></div>
</body>
</html>