[postgis-users] Strange intersection behavior
Obe, Regina
robe.dnd at cityofboston.gov
Mon Dec 29 10:19:25 PST 2008
Andreas,
I think you have unearthed one of the cruel lessons of floating point math.
Best described in Isaac Kunen's blog.
http://blogs.msdn.com/isaac/archive/2008/08/07/the-imprecise-nature-of-geometry.aspx
So we see it is not unique to PostGIS.
Hope that helps,
Regina
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net on behalf of Andreas Albarello
Sent: Mon 12/29/2008 1:06 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Strange intersection behavior
Hi list,
I'm at a loss as to what is happening here. I'm using PostgreSQL 8.3.5
along with PostGIS 1.3.5 on Windows.
So this query works fine:
select astext(intersection(geomfromtext('LINESTRING(8.30234187721807
46.6802395904018,6.3382169942078 46.3031276124166)'),
geomfromtext('LINESTRING(7.32028160673789
46.4916949088309,7.32028323240689 46.491581924505)')));
Now I'd expect this query to work too:
select
astext(intersection(intersection(geomfromtext('LINESTRING(8.30234187721807
46.6802395904018,6.3382169942078 46.3031276124166)'),
geomfromtext('LINESTRING(7.32028160673789
46.4916949088309,7.32028323240689 46.491581924505)')),
geomfromtext('LINESTRING(7.32028160673789
46.4916949088309,7.32028323240689 46.491581924505)')));
i.e., intersecting the intersection with the original line. Weirdly
enough, I'm getting GEOMETRYCOLLECTION EMPTY. This has nothing to do
with using geomfromtext, tried the same thing inside plpgsql and got the
same result. Besides, geomfromtext ought to be deterministic anyways.
Same thing goes for this:
select
intersects(line_interpolate_point(geomfromtext('LINESTRING(7.32028160673789
46.4916949088309,7.32028323240689 46.491581924505)'), 0.1),
geomfromtext('LINESTRING(7.32028160673789
46.4916949088309,7.32028323240689 46.491581924505)'));
returns false.
Can anyone shed some light on this?
TIA
--
--------------------------------------------------------------------
Andreas Albarello
Analysis & SW Development
Territorium Online srl/GmbH
Via Buozzi Str. 12
I 39100 Bolzano/Bozen
Phone: +39 0471 068611
Fax: +39 0471 068619
email: andreas.albarello at territoriumonline.com
web: http://www.territoriumonline.com
--------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081229/e6c8bb0b/attachment.html>
More information about the postgis-users
mailing list