Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Calculate Distance using Lat and Lon?

Status
Not open for further replies.
Sep 13, 2002
28
US
Does anyone know of a method of calculating staight-line distance between 2 points using latitude and longitude?

Thanks,

Bill
 
By entering "Distance Lat Long Algorithm" onto the Google Search page I found the following posting:


On that page they give the following:

==========================================
The algorithm below will calculate great circle distances between pairs of lat/long coordinates. I pulled it out of one of my SAS programs, but the syntax is pretty basic. It uses lat/longs in radians, and the distance is in kilometers. Take out the 57.29578 factor to use lat/longs in degrees,
and take out the 1.852 factor to get distance in nautical miles.
DISTANCE =3D 1.852 * 60 * 57.29578 * ARCOS((SIN(LAT1) *
SIN(LAT2)) + (COS(LAT1) * COS(LAT2)) *
COS(LON2 - LON1))
==========================================

There are other references there also.

I cannot attest to the accuracy of the algorithm, but you might want to check it out and/or use Google to look for more. There seemed to be quite a few discovered web pages.

Good Luck,
JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top