[postgis-users] DISTANCE function doesn't work at 179,-179 degrees

Andrew Edmondson a.edmondson at eris.qinetiq.com
Wed Oct 22 08:39:05 PDT 2003


I have two points either side of the 180 degree line on a sphere. (example included)
Calling DISTANCE on them, doesn't yield the result 2, but rather 357...
Have I not actually got a sphere?
Or does DISTANCE not do what I expect?

Thanks,

-Ed

<example>

test=# SELECT * FROM location;;
 location_id | latlong          
-------------+--------------------------
           1 |  SRID=4278;POINT(0 0)
           2 |  SRID=4278;POINT(0 90)
           3 |  SRID=4278;POINT(0 179)
           4 |  SRID=4278;POINT(0 -179)
(4 rows)

test=# SELECT DISTANCE(latlong, GeometryFromText('POINT(0 178)',4278)) from location;
     distance     
------------------
              178
               88
                1
              357
(4 rows)

</example>

-- 
##############################################################################
Andrew Edmondson
PGP Key: http://search.keyserver.net:11371/pks/lookup?op=get&search=0xCEE814DC
PGP Fingerprint: 7B32 4D1E AC4F 29E2 9EAA 9550 1A3D BBA4 CEE8 14DC





More information about the postgis-users mailing list