473,657 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 17426
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********@toa st.net> wrote in message
news:O3******** ******@TK2MSFTN GP11.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****@communi ty.nospam> wrote in message
news:%2******** *******@TK2MSFT NGP11.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********@toa st.net> wrote in message
news:O3******** ******@TK2MSFTN GP11.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*l at1)+0.00012*Co s(5*lat1)

dif = Abs(lon1 - lon2)

xdist = Acos(Sin(lat1)* Sin(lat2)+Cos(l at1)*Cos(lat2)* Cos(dif))

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********@toa st.net> wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
WOW!! That is exactly what I needed! Thanks, Tom.

"Tom Dacon" <td****@communi ty.nospam> wrote in message
news:%2******** *******@TK2MSFT NGP11.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********@toa st.net> wrote in message
news:O3******** ******@TK2MSFTN GP11.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
3881
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 are pre-calculated and passed to the query. SELECT * FROM Locations
4
3812
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 addresses. Using the zip code 10010, it takes almost 60 seconds to return 122 businesses within a 25 mile radius. This slowdown is almost entirely due to the query radius distance formula.
2
1764
by: Galsaba | last post by:
anyone knows what the formula is for finding a distance betweeen 2 zip codes? Aaron
2
1630
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
4763
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 longitudes. The calculation for this is as follows: (The latitudes and longitudes must be converted to radians (radians=degrees * pi / 180)). PI must be set set to 20 decimals as follows: PI = 3.1419265358979323846 Earth's Radius = 3963.1
1
4058
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. #include <cmath> #include <string> #include <iostream> #include <fstream> #include <cstdlib> using namespace std;
0
1413
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 alphabet A-Y for the function that loads the image. They also have each have a value A1-Y1 for their starting locations. I already have my collision detection written for when the mouse is clicked on one of these objects so thats not a problem. I then...
105
6161
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
1295
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) It does not give me correct result when the point is other than USA Thanks
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.