<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content="MSHTML 5.50.4522.1800" name=GENERATOR></META></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=375295108-16092009>Niklas</SPAN></FONT>
</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=375295108-16092009></SPAN></FONT>
</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=375295108-16092009>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. </SPAN></FONT>
</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=375295108-16092009></SPAN></FONT>
</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=375295108-16092009>Regrads</SPAN></FONT>
</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=375295108-16092009>Horst</SPAN></FONT>
</DIV>
<DIV>
</DIV>
<P>
<FONT face=Arial color=#000000
size=2>------------------------------------------------</FONT>
</P>
<P><FONT face=Arial color=#000000 size=2>Dr. Horst Düster</FONT> <BR>
<FONT
face=Arial color=#000000 size=2>Stv. Amtschef / GIS-Koordinator </FONT>
</P>
<P><FONT face=Arial color=#000000 size=2>Kanton Solothurn</FONT> <BR>
<FONT
face=Arial color=#000000 size=2>Bau- und Justizdepartement</FONT> <BR>
<FONT
face=Arial color=#000000 size=2>Amt für Geoinformation</FONT> <BR>
<FONT
face=Arial color=#000000 size=2>SO!GIS Koordination</FONT> <BR>
<FONT face=Arial
color=#000000 size=2>Rötistrasse 4</FONT> <BR>
<FONT face=Arial color=#000000
size=2>CH-4501 Solothurn</FONT>
</P>
<P><FONT face=Arial color=#000000 size=2>Telefon ++41(0)32 627 25 32</FONT>
<BR>
<FONT face=Arial color=#000000 size=2>Telefax ++41(0)32 627 22 14</FONT>
</P>
<P><FONT face=Arial color=#000000 size=2><A target=_blank
href="mailto:horst.duester@bd.so.ch">mailto:horst.duester@bd.so.ch</A></FONT>
<BR>
<FONT face=Arial color=#000000 size=2><A target=_blank
href="http://www.agi.so.ch/">http://www.agi.so.ch</A></FONT>
</P>
<DIV>
</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT face="Times New Roman" size=2>-----Ursprüngliche
Nachricht-----<BR>
<B>Von:</B> nicklas.aven@jordogskog.no
[mailto:nicklas.aven@jordogskog.no]<BR>
<B>Gesendet am:</B> Mittwoch, 16.
September 2009 10:23<BR>
<B>An:</B> PostGIS Users Discussion<BR>
<B>Betreff:</B>
Re: [postgis-users] st_intersection error<BR>
</DIV></FONT>
<P>
<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>
<P>
</P></BLOCKQUOTE></BODY></HTML>