[postgis-users] distance between two POINTM

Michael Fuhr mike at fuhr.org
Sun May 13 12:50:39 PDT 2007


On Sun, May 13, 2007 at 01:37:00PM -0600, Michael Welter wrote:
> I'm trying to calculate the distance between two POINTM.  The points are 
> as received from a Garmin GPS and include the elevation of 2500m (I'm in 
> the mountains).
> 
> The GPS receiver reported 5.2km between the two points, while 
> distance_sphere() reported 4.5km.
> 
> What is the proper method to calculate distance on the earth's surface?

Use distance_sphere() or distance_spheroid().  A common mistake is
to define the points as (latitude longitude), which is (Y X), when
they should be (longitude latitude), which is (X Y).  If that's not
the problem then please post the coordinates and the query you're
running.

-- 
Michael Fuhr



More information about the postgis-users mailing list