comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: how to calculate distance from pairs of latitude/longitude measurements?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: how to calculate distance from pairs of latitude/longitude measurements? [message #65596] Wed, 11 March 2009 18:24
Greg Hennessy is currently offline  Greg Hennessy
Messages: 45
Registered: November 2005
Member
On 2009-03-11, llo <bernat.puigdomenech@gmail.com> wrote:

> the result is 0.8777. 0.8777 distance from montreal to albany ????

You did remember to convert to radians before doing the trig
functions, did you not?
Re: how to calculate distance from pairs of latitude/longitude measurements? [message #65597 is a reply to message #65596] Wed, 11 March 2009 18:23 Go to previous message
Greg Hennessy is currently offline  Greg Hennessy
Messages: 45
Registered: November 2005
Member
On 2009-03-11, llo <bernat.puigdomenech@gmail.com> wrote:
> d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2 ))
>
> A mathematically equivalent formula, which is less subject to rounding
> error for short distances is:
>
> d=2*asin(sqrt((sin((lat1-lat2)/2))^2 + cos(lat1)*cos(lat2)*(sin((lon1-
> lon2)/2))^2))
>
> the result is 0.8777. 0.8777 distance from montreal to albany ????

Strange, the answer to your calculation is in radians, so needs to be
multiplied by the radius of the earth, but that number doesn't seem
correct either.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how to calculate distance from pairs of latitude/longitude measurements?
Next Topic: tvimage with log axis?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:35:24 PDT 2025

Total time taken to generate the page: 0.00463 seconds