calc distance in miles

Kenneth Brody kenbrody at bestweb.net
Mon Jun 18 16:17:32 PDT 2007


Quoting Richard D. Williams (Mon, 18 Jun 2007 18:00:07 -0500):

> Does anyone have a formula using two coordinates in latitude and
> longitude to calculate distance in miles?

GIYF.

First:

    http://www.nhc.noaa.gov/gccalc.shtml

which points to:

    http://williams.best.vwh.net/avform.htm#Dist

    The great circle distance d between two points with coordinates
    {lat1,lon1} and {lat2,lon2} is given by:

        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))

--
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list