<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.38">
<TITLE>RE: [postgis-users] Strange intersection behavior</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Andreas,<BR>
<BR>
I think you have unearthed one of the cruel lessons of floating point math.<BR>
<BR>
Best described in Isaac Kunen's blog.<BR>
<BR>
<A HREF="http://blogs.msdn.com/isaac/archive/2008/08/07/the-imprecise-nature-of-geometry.aspx">http://blogs.msdn.com/isaac/archive/2008/08/07/the-imprecise-nature-of-geometry.aspx</A><BR>
<BR>
So we see it is not unique to PostGIS.<BR>
<BR>
Hope that helps,<BR>
Regina<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: postgis-users-bounces@postgis.refractions.net on behalf of Andreas Albarello<BR>
Sent: Mon 12/29/2008 1:06 PM<BR>
To: postgis-users@postgis.refractions.net<BR>
Subject: [postgis-users] Strange intersection behavior<BR>
<BR>
Hi list,<BR>
<BR>
I'm at a loss as to what is happening here. I'm using PostgreSQL 8.3.5<BR>
along with PostGIS 1.3.5 on Windows.<BR>
<BR>
So this query works fine:<BR>
<BR>
select astext(intersection(geomfromtext('LINESTRING(8.30234187721807<BR>
46.6802395904018,6.3382169942078 46.3031276124166)'),<BR>
geomfromtext('LINESTRING(7.32028160673789<BR>
46.4916949088309,7.32028323240689 46.491581924505)')));<BR>
<BR>
Now I'd expect this query to work too:<BR>
<BR>
select<BR>
astext(intersection(intersection(geomfromtext('LINESTRING(8.30234187721807<BR>
46.6802395904018,6.3382169942078 46.3031276124166)'),<BR>
geomfromtext('LINESTRING(7.32028160673789<BR>
46.4916949088309,7.32028323240689 46.491581924505)')),<BR>
geomfromtext('LINESTRING(7.32028160673789<BR>
46.4916949088309,7.32028323240689 46.491581924505)')));<BR>
<BR>
i.e., intersecting the intersection with the original line. Weirdly<BR>
enough, I'm getting GEOMETRYCOLLECTION EMPTY. This has nothing to do<BR>
with using geomfromtext, tried the same thing inside plpgsql and got the<BR>
same result. Besides, geomfromtext ought to be deterministic anyways.<BR>
<BR>
Same thing goes for this:<BR>
<BR>
select<BR>
intersects(line_interpolate_point(geomfromtext('LINESTRING(7.32028160673789<BR>
46.4916949088309,7.32028323240689 46.491581924505)'), 0.1),<BR>
geomfromtext('LINESTRING(7.32028160673789<BR>
46.4916949088309,7.32028323240689 46.491581924505)'));<BR>
<BR>
returns false.<BR>
<BR>
Can anyone shed some light on this?<BR>
<BR>
TIA<BR>
<BR>
--<BR>
--------------------------------------------------------------------<BR>
Andreas Albarello<BR>
Analysis & SW Development<BR>
<BR>
Territorium Online srl/GmbH<BR>
Via Buozzi Str. 12<BR>
I 39100 Bolzano/Bozen<BR>
<BR>
Phone: +39 0471 068611<BR>
Fax: +39 0471 068619<BR>
<BR>
email: andreas.albarello@territoriumonline.com<BR>
web: <A HREF="http://www.territoriumonline.com">http://www.territoriumonline.com</A><BR>
--------------------------------------------------------------------<BR>
_______________________________________________<BR>
postgis-users mailing list<BR>
postgis-users@postgis.refractions.net<BR>
<A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>
<BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>
<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>