473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Distance formula from Long/Lat Coord

Does anyone here have the formula for calculating distance give two pairs of
Longitude/Latitude coordinates? Please share this with me if you would.

--
Greg
Nov 21 '05 #1
4 17405
Convert the latitudes and longitudes to radians, observing that latitude is
positive in the northern hemisphere, and negative in the southern
hemisphere, and by convention among astronomers east longitude is positive
and west longitude is negative (why? No one knows).

Let's call one point the 'start point' and the other one the 'end point.

Let L be the start point latitude in radians, and D be the end point
latitude in radians.

Let LHA be the difference between the two longitudes, in radians.

Then the sine of the distance angle between the two points, measured from
the center of the earth, is:

sin(distance angle) = sin(L) * sin(D) + cos(L) * cos(D) * cos(LHA)

and the angle in radians of the distance angle is:

da = asin(distance angle).

Convert this angle to degrees.

On a theoretically spherical earth, an angle of one degree subtends 60
nautical miles. So multiply the distance angle in degrees by sixty, and you
have what's called the "Great Circle Distance" between the points in
nautical miles of 6000 feet. To convert to land miles, multiply by
6000/5280.

Regards,
Tom Dacon
Dacon Software Consulting
"DellaCroce" <De********@toast.net> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Does anyone here have the formula for calculating distance give two pairs of Longitude/Latitude coordinates? Please share this with me if you would.

--
Greg

Nov 21 '05 #2
WOW!! That is exactly what I needed! Thanks, Tom.

"Tom Dacon" <td****@community.nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Convert the latitudes and longitudes to radians, observing that latitude is positive in the northern hemisphere, and negative in the southern
hemisphere, and by convention among astronomers east longitude is positive
and west longitude is negative (why? No one knows).

Let's call one point the 'start point' and the other one the 'end point.

Let L be the start point latitude in radians, and D be the end point
latitude in radians.

Let LHA be the difference between the two longitudes, in radians.

Then the sine of the distance angle between the two points, measured from
the center of the earth, is:

sin(distance angle) = sin(L) * sin(D) + cos(L) * cos(D) * cos(LHA)

and the angle in radians of the distance angle is:

da = asin(distance angle).

Convert this angle to degrees.

On a theoretically spherical earth, an angle of one degree subtends 60
nautical miles. So multiply the distance angle in degrees by sixty, and you have what's called the "Great Circle Distance" between the points in
nautical miles of 6000 feet. To convert to land miles, multiply by
6000/5280.

Regards,
Tom Dacon
Dacon Software Consulting
"DellaCroce" <De********@toast.net> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Does anyone here have the formula for calculating distance give two
pairs of
Longitude/Latitude coordinates? Please share this with me if you would.

--
Greg


Nov 21 '05 #3

Dim AdjLatDist, dif, xdist As Double

DegLatDist = 111.13295-0.55982*Cos(2*lat1)+0.00012*Cos(5*lat1)

dif = Abs(lon1 - lon2)

xdist = Acos(Sin(lat1)*Sin(lat2)+Cos(lat1)*Cos(lat2)*Cos(d if))

return xdist * (180/pi) * DegLatDist

' Result in KM - for mile multiply by .6214

Denis
DellaCroce wrote:
Does anyone here have the formula for calculating distance give two pairs of
Longitude/Latitude coordinates? Please share this with me if you would.


Nov 21 '05 #4
Google is just great isnt it ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"DellaCroce" <De********@toast.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
WOW!! That is exactly what I needed! Thanks, Tom.

"Tom Dacon" <td****@community.nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Convert the latitudes and longitudes to radians, observing that latitude

is
positive in the northern hemisphere, and negative in the southern
hemisphere, and by convention among astronomers east longitude is positive and west longitude is negative (why? No one knows).

Let's call one point the 'start point' and the other one the 'end point.

Let L be the start point latitude in radians, and D be the end point
latitude in radians.

Let LHA be the difference between the two longitudes, in radians.

Then the sine of the distance angle between the two points, measured from the center of the earth, is:

sin(distance angle) = sin(L) * sin(D) + cos(L) * cos(D) * cos(LHA)

and the angle in radians of the distance angle is:

da = asin(distance angle).

Convert this angle to degrees.

On a theoretically spherical earth, an angle of one degree subtends 60
nautical miles. So multiply the distance angle in degrees by sixty, and

you
have what's called the "Great Circle Distance" between the points in
nautical miles of 6000 feet. To convert to land miles, multiply by
6000/5280.

Regards,
Tom Dacon
Dacon Software Consulting
"DellaCroce" <De********@toast.net> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Does anyone here have the formula for calculating distance give two

pairs
of
Longitude/Latitude coordinates? Please share this with me if you would.
--
Greg



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Xenophobe | last post by:
I have successfully converted the ASP code included in the following article to PHP: http://www.4guysfromrolla.com/webtech/040100-1.shtml As described the high and low latitudes and longitudes...
4
by: Xenophobe | last post by:
I have successfully created a zip code radius search, but the performance is unacceptable. I have two tables. The first is 52K zip codes w/lat and long. The second is 3K national business...
2
by: Galsaba | last post by:
anyone knows what the formula is for finding a distance betweeen 2 zip codes? Aaron
2
by: Bob Jenkins | last post by:
Set A={y1,y2,y3} How can i find set B={y2-y1,y3-y2,y3-y1} in a fast way? Thanks! -Bob
1
by: radskate360 | last post by:
Hi I am newer to programming and need a bit of help with this program. OK, heres the directions. The distance between two places on earth can be calculated by using their latitudes and...
1
by: tiffrobe | last post by:
I'm a little lost on my program. Everything works fine except function 3. It gives out garbage numbers. Its suppose to give the distance between two points and then the area of 2 circles. ...
0
by: PythonNotSoGuru | last post by:
Hi everyone. XP Service pack 2, english, python, I am just wondering how i could go about doing this. I am using pygame to draw 25 objects on the screen and they each are assigned a letter of the...
105
by: Keith Thompson | last post by:
pereges <Broli00@gmail.comwrites: These types already have perfectly good names already. Why give them new ones? If you must rename them for some reason, use typedefs, not macros. --
0
by: jyoti kelkar | last post by:
Hi I am using following formula to find end point lat long given start point lat long azimuth and distance Latitude(In degrees) + radius (in degrees) * Math.Sin(90 - Azimuth)(in radians) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.