Previous in Forum: Replacing Microsoft Outlook   Next in Forum: CoDeSys and CANbus
Close
Close
Close
20 comments
Rate Comments: Nested
Active Contributor

Join Date: Sep 2008
Location: India,Vagabond
Posts: 22

Distance Calculation from Latitude and Longitude

09/23/2009 3:10 AM

When a latitude and longitude are given which is the most effective way to calculate the distance from two co-ordinates.

__________________
True strength comes from the loss of ignorance,even in martial arts.
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru

Join Date: Mar 2007
Location: City of Light
Posts: 3943
Good Answers: 183
#1

Re: Distance calculation from latitude and logitude

09/23/2009 5:46 AM

Every location is in a plane defined by the longitude and passing through the poles. With respect to the origin this plane has an angle given by the longitude. In every plane the location is defined by the angle between the radius going from earth centre to the point and the equatorial plane.

One has thus 3 angles φ= angle between the 2 above defined planes=φ2-φ1 where φi= longitude and the latitude angles ψ1 and ψ2 =the latitudes in every plane. With those values one can determine the angle between the radius from earth centre to the 2 locations as being ξ and compute the distance on a big circle going through the 2 locations as L=R*ξ(radians). The value of ξ is (if I am not wrong)=

acos(0.5*cosψ1*cosψ2*(1/(cosψ1)^2+1/(cosψ2)^2-(4*(sin(φ/2))^2+(tan(ψ2)-tan(ψ2))^2)^0.5)

May be there is a simpler method but at least this one I computed myself. It is a good exercise not to forget how space geometry works.

Register to Reply
3
Power-User
New Zealand - Member - Member Australia - Member - Member

Join Date: Oct 2008
Location: Auckland, New Zealand
Posts: 463
Good Answers: 43
#2

Re: Distance calculation from latitude and logitude

09/23/2009 7:25 AM

Hi talos,

If you presume the earth is round for the sake of simplicity;

R = earth's radius (mean radius = 6,371km)
Δlat = lat2− lat1
Δlong = long2− long1
a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2)
c = 2.atan2(√a, √(1−a))
d = R.c

Note - angles need to be in radians for trig functions

Try a search on Haversine formula

Register to Reply Good Answer (Score 3)
Guru

Join Date: May 2006
Location: Placerville, CA (38° 45N, 120° 47'W)
Posts: 6215
Good Answers: 248
#8
In reply to #2

Re: Distance calculation from latitude and logitude

09/24/2009 10:44 AM

"Note - angles need to be in radians for trig functions"

That is true if you are using a spreadsheet to do the calculations. Many, if not most, calculators that can do trig can select either degrees or radians.

I've often wondered why spreadsheets don't offer that choice...

__________________
Teaching is a great experience, but there is no better teacher than experience.
Register to Reply
Guru

Join Date: Jul 2007
Posts: 4448
Good Answers: 143
#3

Re: Distance Calculation from Latitude and Logitude

09/23/2009 8:22 AM
__________________
"Well, I've wrestled with reality for 35 years, Doctor, and I'm happy to state I finally won out over it." Elwood P. Dowd
Register to Reply Score 1 for Good Answer
Guru
Popular Science - Biology - New Member Hobbies - Musician - New Member APIX Pilot Plant Design Project - Member - New Member Hobbies - CNC - New Member Fans of Old Computers - ZX-81 - New Member

Join Date: Jan 2007
Location: Centurion, South Africa
Posts: 3921
Good Answers: 97
#4

Re: Distance Calculation from Latitude and Longitude

09/23/2009 10:22 AM

Which projection do you use in India?

Do you want to do xy to LatLong as well?

__________________
Never do today what you can put of until tomorrow - Student motto
Register to Reply
Power-User
Engineering Fields - Systems Engineering - Member for some time now, see my profile.

Join Date: Aug 2007
Location: Essex, UK
Posts: 364
Good Answers: 3
#6

Re: Distance Calculation from Latitude and Longitude

09/24/2009 10:28 AM

For distance and other calculations on the surface of the earth you need to remembe that the earth is not a perfect sphere.

Years ago I used a simple programme on an HP programmable calculator that enabled an input from the projection used and the oblateness of the earth to ensure that the accuracy of the result was adeqiuate for what I was doing at the time.

Read a good book on Sperical trigonometry.
Look at some survey work and you will soon be up to speed.

Of couse, in this day and age everyone is playing with GPS to do the work for them; but that way you do not learn!!

Good Luck

Sleepy

Register to Reply
Guru

Join Date: Oct 2007
Location: Tulare, CA
Posts: 1783
Good Answers: 35
#7

Re: Distance Calculation from Latitude and Longitude

09/24/2009 10:37 AM

Simple.

You get a chart of that region and a pair of dividers.

You expand the points on the dividers from one point of the chart to the other point.

Then you take your dividers to the Latitude scale on the right or left margins of the chart and get your reading.

Depending on the scale of the chart, each mark should be 1 nautical mile each.

You cannot use the Longitude located on the top and bottom of the chart for measuring distance.

Also note: You cannot use the latitude scale from one chart to another if the Latitudes are different the closer you get to the equator. You have to use the scales of the chart given, even when it is indicated that the scales of two different charts are the same because they are not.

A nautical mile close the the equator is longer then a nautical mile as you get closer to the poles.

__________________
Why is there never enough time to do it right the first time but always enough time to do it over?
Register to Reply
Guru

Join Date: May 2006
Location: Placerville, CA (38° 45N, 120° 47'W)
Posts: 6215
Good Answers: 248
#10
In reply to #7

Re: Distance Calculation from Latitude and Longitude

09/24/2009 7:25 PM

"A nautical mile close the the equator is longer then a nautical mile as you get closer to the poles."

NO!

1 nautical mile = 1.85200 kilometers

An East-West nautical mile does cover a larger fraction of a degree longitude as you get farther from the equator, but that's because the degree of longitude gets smaller; the length of the nautical mile remains the same.

__________________
Teaching is a great experience, but there is no better teacher than experience.
Register to Reply
Guru

Join Date: Oct 2007
Location: Tulare, CA
Posts: 1783
Good Answers: 35
#11
In reply to #10

Re: Distance Calculation from Latitude and Longitude

09/25/2009 10:50 AM

1 Nautical mile = 1.15 miles.

I was in the Navy and stationed on minesweepers. The ones that were used in the Persian Gulf in the late 1980's to early 1990". I operated in the The Puget Sound and Straits of Juan de Fuca, Persian Gulf and San Diego. In each location we had to calculate the difference in the distance of a nautical mile because the difference between a nautical mile in San Diego to the Puget Sound was about 112 yards difference.

On mine sweepers we had to be extremely accurate in navigation because the information we obtained prosecuting mines had to be delivered to an EOD team so they can later go out and neutralize the mine. We had to be accurate to within a few yards, unlike the ocean going vessels that were happy to be within 1/2 of a mile of their actual position in accuracy.

As you go from the poles towards the equator the latitudinal lines get further apart. It is related to the curvature of the Earth.

It's a radical change like the longitude lines but there is still some variation.

__________________
Why is there never enough time to do it right the first time but always enough time to do it over?
Register to Reply
Guru

Join Date: May 2006
Location: Placerville, CA (38° 45N, 120° 47'W)
Posts: 6215
Good Answers: 248
#13
In reply to #11

Re: Distance Calculation from Latitude and Longitude

09/26/2009 11:31 AM

"1 Nautical mile = 1.15 miles." Correct, to 3 digits accuracy. For the mine sweeping operations you describe, you need a whole lot more than three digits of accuracy.

Both the nautical mile and the statute mile are distance units. ALL distance units are now (since 1983) defined, directly or indirectly, in terms of wavelengths of laser light. The basic unit is the meter (or metre). A cm is exactly 1/100 of a meter, an inch is exactly 2.54 cm, a foot is exactly 12 inches, and a statute mile is exactly 5280 feet.

"The international nautical mile was defined by the First International Extraordinary Hydrographic Conference, Monaco (1929) as exactly 1852 metres.[1] This is the only definition in widespread current use, and is the one accepted by the International Hydrographic Organization and by the International Bureau of Weights and Measures (BIPM)." (from Wikipedia)

As you indicate, meridians get closer together until they meet at the poles, and the separation (distance in whatever distance units) between whole-degree parallels does change from place to place due to the variation from true spherical shape of the Earth, but the distance unit values do NOT change! (The degree is not a unit of distance, but of angle)

__________________
Teaching is a great experience, but there is no better teacher than experience.
Register to Reply Score 1 for Good Answer
Guru

Join Date: Oct 2007
Location: Tulare, CA
Posts: 1783
Good Answers: 35
#17
In reply to #13

Re: Distance Calculation from Latitude and Longitude

09/29/2009 10:47 AM

We did, we went to the 4th digit. We entered our information as 47 degrees 10.1234 minutes. The fourth digit is yards.

__________________
Why is there never enough time to do it right the first time but always enough time to do it over?
Register to Reply
Guru

Join Date: May 2006
Location: Placerville, CA (38° 45N, 120° 47'W)
Posts: 6215
Good Answers: 248
#18
In reply to #17

Re: Distance Calculation from Latitude and Longitude

09/29/2009 12:01 PM

I presume you are referring to the 4th digit past the decimal place in the 'minutes' part of the value. That is 47 and 10.1234/60 degrees. 10.1234 has 5 or 6 digits of precision (initial ONEs are sometimes not considered significant), so 10.1234/60° is correctly expressed as 0.168723°, and the full measurement is then 47.168723°. You are specifying the angle to eight digits of precision.

Ignoring the deviation from a true sphere, the Earth has a polar circumference of 24,860 miles, so one degree of latitude is 24,860/360=1180.2 miles, or 6,231,280 feet (more correctly expressed as 6.2312x106 feet, based on the precision of the circumference figure, which was supposedly correct to 5 digits.). The 8th digit would then be tenths of a foot. The same reasoning could also be used to say the 8th digit would be tenths of a yard. In any case, distances in whole yards would end with the 7th digit in decimal degrees, or the 3rd digit in degrees and minutes.

Once again, the important point is that the definition of any unit of distance, including the nautical mile, must not change depending on your location or the shape of the Earth, or anything else.

The separation between two points on Earth, specified by an angular separation value, does depend on the size and shape of the Earth in that region, but the definition of the distance unit does NOT change.

__________________
Teaching is a great experience, but there is no better teacher than experience.
Register to Reply
Commentator

Join Date: Jan 2008
Posts: 83
#19
In reply to #18

Re: Distance Calculation from Latitude and Longitude

10/22/2009 2:20 AM

Is there a mistake here ? I always thought that one deg lat was about 69 miles. 24,860 miles divided by 360 degrees = 69.05 miles [ and not 1180?] I do agree that the nautical unit remains the same and the conversion to degrees changes for different global positions.

Register to Reply
Guru

Join Date: May 2006
Location: Placerville, CA (38° 45N, 120° 47'W)
Posts: 6215
Good Answers: 248
#20
In reply to #19

Re: Distance Calculation from Latitude and Longitude

10/22/2009 11:21 AM

WOW! it took almost a month for someone to notice that glaring error! I have no idea what combination of buttons I pressed to come up with that 1180, or why it did not occur to me that in that case California would only be around a half degree from N-S, but obviously you are right! Specifically, 69.056 miles, to the same precision as the original circumference.

Again, the main point is that no distance unit can vary depending on where the measurement is taken.

__________________
Teaching is a great experience, but there is no better teacher than experience.
Register to Reply
Power-User

Join Date: Aug 2006
Location: Central Florida in the good old US of A
Posts: 332
Good Answers: 2
#14
In reply to #11

Re: Distance Calculation from Latitude and Longitude

09/28/2009 2:51 PM

That blows my mind; a nautical mile is 2000 yards wherever you are. The only thing I can figure out what the difference is would be that you were calculating was the distance between lines of longitude for San Diego and Puget Sound above the equator; since lines of latitude are "whatever number of miles" apart at the equator and zero miles apart at the poles.

__________________
Eschew obfuscation.
Register to Reply
Guru

Join Date: May 2006
Location: Placerville, CA (38° 45N, 120° 47'W)
Posts: 6215
Good Answers: 248
#15
In reply to #14

Re: Distance Calculation from Latitude and Longitude

09/28/2009 4:05 PM

You are right, but only to 2 digits of precision (1 nautical mile = 2,025.3718... yards)

__________________
Teaching is a great experience, but there is no better teacher than experience.
Register to Reply
Guru

Join Date: Oct 2007
Location: Tulare, CA
Posts: 1783
Good Answers: 35
#16
In reply to #14

Re: Distance Calculation from Latitude and Longitude

09/29/2009 10:32 AM

2000 yards is the general rule of thumb. If you were to ask the majority of sailors that work with navigation, they are going to tell you 2000 yards. However if you ask someone from the Minesweeper community in the Navy, that has actually operated in different regions and worked with the ISS/Hyperfix system that works off of Loran C, there are distance variation the further North or South you go from the equator. We had to input that difference into the Hyperfix to be accurate. We had to be within a few yards in accuracy and taking the general 2000 yards wouldn't give us that.

You never, ever measure your distance from the longitude scales.

If you were to take a series of charts that plot your track towards the north or south poles that are all the same scale and measure your dividers from one chart and compare to the marks on the next chart, you will start seeing a deviation.

__________________
Why is there never enough time to do it right the first time but always enough time to do it over?
Register to Reply
Guru

Join Date: Aug 2006
Posts: 4484
Good Answers: 246
#9

Re: Distance Calculation from Latitude and Longitude

09/24/2009 12:44 PM

Of course it depends upon what you are trying to achieve. In practical terms, much navigation in small planes and boats is done without regard to the fact the the earth is really an approximate sphere. Years ago I wrote a program for flight planning, into which I would enter coordinates, and the output (based on having "flattened" the earth's surface, as charts do) a distance and direction to fly, (based upon wind aloft, etc.). It was plenty close enough.

__________________
There is more to life than just eating mice.
Register to Reply
Active Contributor

Join Date: Nov 2007
Posts: 21
#12

Re: Distance Calculation from Latitude and Longitude

09/26/2009 4:08 AM

imagine , A(24-15- 33 , 46-15-30) and B(27-15-33 , 50-15-30) are the two points, with their assumed longitudes and latitudes. the simplest and rough calculation is like this.plot the grid with these coordinates, two parrell lines for longitudes and another two parrell lines for latitudes. the lines for longitudes and latitudes shall be perpendicular to each other.

calculate the difference between two longitudes and similarly between two latitudes. add the squares of these two differences. take the square root of resultant. this depicts the hypertenuse of the right angled traiangle of which the other two sides are represented by the differences of longitudes and latitudes.

now we know that 360 degrees corressponds to an arc of 2 pi R of earth, R being its radius 6371 KM. 2 pi R works out as 40,000 KM. in the particular example the hypertenuse comes out to be 5 degrees. so the distance between A and B works out to be 555.55 KM @ 360 degrees = 40,000 KM.

it is a very rough method. however i used to use great circle method by lenkurt demodulator, for planning of my microwave towers, long back. please come back for any clarification. thanks.

Register to Reply
Register to Reply 20 comments

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

AussieBob (1); Blink (1); dkwarner (6); gajendrasingh01 (1); gsuhas (1); Hendrik (1); Janissaries (4); Kyoto (1); nick name (1); pretzel (1); Sleepy (1); TVP45 (1)

Previous in Forum: Replacing Microsoft Outlook   Next in Forum: CoDeSys and CANbus
You might be interested in: Distance Meters, GPS Chips, Proximity Sensors

Advertisement