[postgis-users] very inaccurate distance using "distance_spheroid" on geometric coordinates

Michael Fuhr mike at fuhr.org
Sat Oct 20 08:58:14 PDT 2007


On Thu, Oct 18, 2007 at 09:06:40AM -0700, Paul Ramsey wrote:
> ST_Distance_Sphere and ST_Distance_Spheroid return in meters, not 
> kilometers, so they think the distance is about 495km.  What makes you so 
> sure that's wrong? I checked in a transformed projection and got a similar 
> result also.
> 
> On 18-Oct-07, at 7:19 AM, hzerres at aol.com wrote:
> 
>>  id |       astext
>> ----+---------------------
>>   1 | POINT(50.783 6.083)
>>   2 | POINT(48.833 10.1)

Also, this appears to be another case of mistakenly using (Y X),
which is (lat lon), when the coordinates should be (X Y), which is
(lon lat).  Aachen is around 6.083E 50.783N, not 50.783E 6.083N.

select st_distance_spheroid(
  st_geomfromtext('POINT(50.783 6.083)'),
  st_geomfromtext('POINT(48.833 10.1)'),
  'SPHEROID["WGS 84",6378137,298.257223563]'
);
 st_distance_spheroid 
----------------------
     493504.202250789
(1 row)

select st_distance_spheroid(
  st_geomfromtext('POINT(6.083 50.783)'),
  st_geomfromtext('POINT(10.1 48.833)'),
  'SPHEROID["WGS 84",6378137,298.257223563]'
);
 st_distance_spheroid 
----------------------
     361365.555820754
(1 row)

-- 
Michael Fuhr



More information about the postgis-users mailing list