[postgis-tickets] [PostGIS] #2168: ST_Distance is not always commutative
PostGIS
trac at osgeo.org
Thu Jan 10 17:48:00 PST 2013
#2168: ST_Distance is not always commutative
---------------------------+------------------------------------------------
Reporter: realityexists | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.1.0
Component: postgis | Version: trunk
Keywords: |
---------------------------+------------------------------------------------
I've found a case where changing the order of operands for
ST_Distance(geog) causes it to return slightly different results:
{{{
SELECT ST_Distance('POINT(-40 46.167)'::geography, 'POINT(0
7.167)'::geography)
- ST_Distance('POINT(0 7.167)'::geography, 'POINT(-40
46.167)'::geography);
}}}
returns 9.31322574615479e-010 on r10952, Windows x64, PostgreSQL 9.1.4 and
9.2.1. On 32-bit Linux it returns 0 as expected.
This caused some odd behaviour in my application, which orders sets of
points by their distance from each other - the result was different
depending on the order in which points were considered. There's an easy
workaround, of course - just round the results - but I can imagine other
developers scratching their heads over this as well.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/2168>
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-tickets
mailing list