Calculating distance from Lat/Long
On Thu, 04 Dec 2003 13:20:40 -0800, "Lloyd Sumpter"
wrote:
Hi,
I'm writing a program for Linux that displays position (from GPS) on a
scanned-in chart, and would like it to calculate distance from current
position to the cursor.
How do you calculate distance between two points using lat/long? If
they're due North/South, I can do it ( 1 minute of lat = 1 NM) but how do
you calculate distance from longitude? Perhaps some formula based on the
circumfrence of the Earth at the equator and the latitude?
Lloyd Sumpter
First, an explanatory note:
inverse cos is also known as arc.cos or cos^-1
The great circle distance is given by
Earth radius * arccos [cos Lat1* cos Lat2 * cos (Long1 - Long2)
+ sin Lat1 * sin Lat2]
The Earth (equatorial) radius is
6378 km, or 3963 statute miles or 3442 NM.
Does this help? (There are other formulae for the same result...)
Brian Whatcott Altus OK
|