[postgis-devel] [PostGIS] #1502: Unrobustness in distance calculations
PostGIS
trac at osgeo.org
Thu Jan 26 18:07:35 PST 2012
#1502: Unrobustness in distance calculations
---------------------+------------------------------------------------------
Reporter: nicklas | Owner: nicklas
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis | Version: 1.5.X
Keywords: |
---------------------+------------------------------------------------------
This one is quite ugly.
{{{
SELECT st_dwithin(a,b,0), st_intersects(a,b),st_distance(a,b) from
(select 'LINESTRING(-97364 -97364, 9736.4 9736.4)'::geometry a, 'POINT(0
0)'::geometry b ) f;
}}}
returns :
f;t;3.086927381169e-11
This is also point-segment problem like #1459
The problem is that the distance is calculated by projecting the point to
the segment and then calculating the distance from the projected point to
the original point.
The projection of the point to the segment is done by calculating where
along the segment from 0 to 1 that the point should be projected. That
value, r, doesn't have enough precision when the segment is long and the
distance to between the original point is small.
This was not a problem pre 1.5 because then the projected point was never
calculated.
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1502>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list