Previous in Forum: Simple Beam Calculation   Next in Forum: finding latitude an longitude of a point
Close
Close
Close
25 comments
Rate Comments: Nested
Active Contributor

Join Date: Nov 2007
Posts: 10

distance calculation between co-ordinates

11/22/2007 12:32 AM

Can anybody tell me the easiest/ simple method to calculate the accurate distance between two points when latitude and longitude of two points are known.

please explain with an example.

Regards,

C.Reddy

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Active Contributor

Join Date: Oct 2006
Posts: 17
Good Answers: 1
#1

Re: distance calculation between co-ordinates

11/22/2007 4:16 AM

Hi,

If your referring to a map, just use an appropriate scale with the reference of the scale of the map and measure the distance between that points.

Regards.

Register to Reply
Guru
New Zealand - Member - Interested in everything- see my Profile please APIX Pilot Plant Design Project - Member - Member Engineering Fields - Electrical Engineering - Member Engineering Fields - Power Engineering - Member Engineering Fields - Civil Engineering - Member Hobbies - Musician - Autoharp and Harmonica Hobbies - Hunting - Member Hobbies - Fishing - Member

Join Date: Nov 2007
Location: Christchurch, (The Garden City), South Island, New Zealand
Posts: 4395
Good Answers: 230
#2

Re: distance calculation between co-ordinates

11/22/2007 4:19 AM
__________________
"The number of inventions increases faster than the need for them at the time" - SparkY
Register to Reply
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
#3

Re: distance calculation between co-ordinates

11/22/2007 4:50 AM

I am not sure if I agree or differ with the formula supplied. I wrote a GIS conversion program in 1983 and will have to look it up.

If I remember correctly, different projections produced different results.

What projection are you working on?

What accuracy are you looking for?

__________________
Never do today what you can put of until tomorrow - Student motto
Register to Reply
Guru
Canada - Member - New Member Hobbies - Musician - New Member

Join Date: Dec 2006
Location: Western Canada
Posts: 1863
Good Answers: 39
#4
In reply to #3

Re: distance calculation between co-ordinates

11/23/2007 12:49 AM

No! no! no! that's way too hard. requires using brain cells.

The easiest/simplest way is to enter the two co-ordinates as waypoints in a GPS receiver. Then use GOTO function to get distance from waypoint1 to waypoint 2. Much easier!! <grin>

the lazy man

__________________
Elnav
Register to Reply
Guru
Engineering Fields - Control Engineering - New Member China - Member - New Member

Join Date: Sep 2006
Location: CHINA
Posts: 2945
Good Answers: 14
#5

Re: distance calculation between co-ordinates

11/23/2007 12:57 AM

you never get accurate distance by two points on earth. its always an approximate value.

it depends on the landform and physognomy. unless its a short distance or a plane or ideal surface of earth, according to your coodinates system. you can get the accurate distance.

Register to Reply
Guru

Join Date: Nov 2006
Location: KnoxTN
Posts: 1485
Good Answers: 6
#6

Re: distance calculation between co-ordinates

11/23/2007 3:23 PM

"Can anybody tell me the easiest/ simple method to calculate the accurate distance between two points when latitude and longitude of two points are known."

What you are asking is neither easy nor simple.

Calculate Distance Between Two Points on Earth

It requires spherical trigonometry. Still not absolute due to deformity of earth and elevation of the two points. While you are at it you can also determine the bearing of the connecting line.

If that is too much trouble make an educated WAG guess.

__________________
Do Nothing Simply When a Way Can be Found to Make it Complex and Wonderful
Register to Reply
Guru

Join Date: Jul 2005
Location: Stoke-on-Trent, UK
Posts: 4496
Good Answers: 137
#20
In reply to #6

Re: distance calculation between co-ordinates

12/19/2007 9:00 AM

Hello Stan

Went to your link and it looked pretty complicated, I'll try to get back to it when I have time.

But before that I came up with a formula. Assuming Earth is a smooth sphere radius R. Latitudes of the 2 points φ1 and φ2. Difference between longitudes Δθ. (Zero longitude is arbitrary and distance only depends on longitude difference.) Then angle ψ between lines from centre of earth to the 2 points is given by

cos ψ = cos φ1.cos φ2.cos Δθ + sin φ1.sin φ2

So distance = R.ψ (ψ in radians). This is shortest distance, along a great circle. It works OK for a few special cases where the answer is already known, but of course that doesn't prove it's right. It also works for negative Δθ and for Δθ > 180° (ie going the long way round)

Anybody find something wrong with it please post. Did it using vector algebra and if anybody's interested I can give the details.

Cheers........Codey

__________________
Give masochists a fair crack of the whip
Register to Reply
Guru

Join Date: Jul 2005
Location: Stoke-on-Trent, UK
Posts: 4496
Good Answers: 137
#21
In reply to #20

Re: distance calculation between co-ordinates

12/20/2007 7:17 AM

Hello again Stan

Had another look at your link and it agrees with mine. Only thing is, in formula for "a", the RHS should all be square-rooted to get the answer 12960.57 km (and to agree with mine).

So in my nomenclature it is

sin ψ = √(sin2 ((φ1- φ2)/2) + cos φ1.cos φ2 sin2 (Δθ/2))

I've tried both formulas with a lot of inputs and got same answers, so though they look different I'm pretty sure they're equivalent. I might try to prove it over Xmas. I'd say my formula is easier to use, specially on a pocket calculator.

Also I don't think the bit about a being < 1 is necessary. I can't make a come to > 1, and if a = 1 the formula still works OK, (and asin (1) = p1/2 rads.

Cheers and Merry Xmas........Codey

__________________
Give masochists a fair crack of the whip
Register to Reply
Guru

Join Date: Jul 2005
Location: Stoke-on-Trent, UK
Posts: 4496
Good Answers: 137
#22
In reply to #21

Re: distance calculation between co-ordinates

12/21/2007 8:43 AM

Hi again Stan

Had a look at this and each formula converts to the other. Wasn't as hard as I expected.

cos ψ = 1 - 2.sin2(ψ/2) standard trig formula

Substituting for sin2(ψ/2) from the "link" formula

cos ψ = 1 - 2.cos φ1.cos φ2.sin2(Δθ/2) - 2.sin2 ((φ1- φ2)/2)

= cos(φ1- φ2) - cos φ1.cos φ2.(1 - cos Δθ) as sin2(Δθ/2) = (1 - cos Δθ)/2

= cos φ1.cos φ2 + sin φ1.cos φ2 - cos φ1.cos φ2 + cos φ1.cos φ2.cos Δθ

= sin φ1.sin φ2 + cos φ1.cos φ2.cos Δθ

So cos ψ = cos φ1.cos φ2.cos Δθ + sin φ1.sin φ2 as in my #20

Cheers

__________________
Give masochists a fair crack of the whip
Register to Reply
Anonymous Poster
#23
In reply to #21

Re: distance calculation between co-ordinates

12/24/2007 12:16 PM

Codey here, not logged on.

Just noticed my formula should read

sin ψ/2 = √(sin2 ((φ1- φ2)/2) + cos φ1.cos φ2 sin2 (Δθ/2))

Codey

Register to Reply
Guru
New Zealand - Member - Interested in everything- see my Profile please APIX Pilot Plant Design Project - Member - Member Engineering Fields - Electrical Engineering - Member Engineering Fields - Power Engineering - Member Engineering Fields - Civil Engineering - Member Hobbies - Musician - Autoharp and Harmonica Hobbies - Hunting - Member Hobbies - Fishing - Member

Join Date: Nov 2007
Location: Christchurch, (The Garden City), South Island, New Zealand
Posts: 4395
Good Answers: 230
#25
In reply to #23

Re: distance calculation between co-ordinates

12/24/2007 10:02 PM

Thanks Codey,

I just received your message, re correct equation, sent via semaphore and signal mirrors.

It does explain why I got myself lost, after using the earlier equation.....

Kind Regards...from wherever I am....

__________________
"The number of inventions increases faster than the need for them at the time" - SparkY
Register to Reply
Guru

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

Re: distance calculation between co-ordinates

11/23/2007 3:45 PM

This applies to your other question as well.

As you probably know, there are 60 nautical miles per degree of longitude at the equator, and 60 nm per degree of latitude. If you write a program (in BASIC, for example) you can interpolate between lines of latitude to get the relevant distance per degree at each degree of latitude. Standard trig will give you the diameters of circles of latitude. If the points you are interested in are not too far apart (1000 nm or so) the errors from straight line distances vs arcs are not too great, depending upon your needs.

I wrote up a program of this nature to calculate flight times and distances (times of which are affected by winds in the real world -- so the errors were of little concern to me, because the error magnitude was less than the error in forecast winds). But if you need real accuracy, then you'd need to use spherical trig, and even that needs to be tempered with actual surface shape.

__________________
There is more to life than just eating mice.
Register to Reply
Guru
New Zealand - Member - Interested in everything- see my Profile please APIX Pilot Plant Design Project - Member - Member Engineering Fields - Electrical Engineering - Member Engineering Fields - Power Engineering - Member Engineering Fields - Civil Engineering - Member Hobbies - Musician - Autoharp and Harmonica Hobbies - Hunting - Member Hobbies - Fishing - Member

Join Date: Nov 2007
Location: Christchurch, (The Garden City), South Island, New Zealand
Posts: 4395
Good Answers: 230
#8

Re: distance calculation between co-ordinates

11/23/2007 4:07 PM

As you require: "the easiest/ simple method" is as follows:

Get a piece of non-stretching string, which is unaffected by wind or thermal expansion/contraction, and will always float on the water surface without being affected by tides or water currents.

Tie one end at point A, mark the string at that point, run out to point B pull taut, and mark the string once again.

Roll up, take home, and measure the string length between the marks you made, where the taut string crossed points A & B.

Add up all your measurements.

The total should be far more accurate than any obtained by calculations.

The method is as you required: easy and simple - it just takes a long time to get the result.

__________________
"The number of inventions increases faster than the need for them at the time" - SparkY
Register to Reply Score 1 for Off Topic
Guru
Hobbies - HAM Radio - New Member

Join Date: Oct 2006
Location: Vancouver (not BC) Washington (not DC) US of A
Posts: 1261
Good Answers: 12
#9

Re: distance calculation between co-ordinates

11/23/2007 10:47 PM

First lets take the 60 nautical miles per degree of curvature.

2. Take the difference in latitude and convert to nautical miles

3. Take the difference in longitude and convert to nautical miles

4. Plug these two values into Pythagoreas theorem as a and b, and solve for c

( c2 = a2 + b2 )

5. Convert the result of c (which is in nautical miles) to miles, kilometers, inches, or your poison of choice.

Because a, b, and c are arc lengths on the surface of the same sphere, Pythagoreas still works.

Register to Reply
Guru

Join Date: Nov 2006
Location: KnoxTN
Posts: 1485
Good Answers: 6
#10
In reply to #9

Re: distance calculation between co-ordinates

11/23/2007 11:11 PM

"Because a, b, and c are arc lengths on the surface of the same sphere, Pythagoreas still works."

Do astronomers and surveyors know about this?

I was under the impression they used spherical trigonometry.

__________________
Do Nothing Simply When a Way Can be Found to Make it Complex and Wonderful
Register to Reply
Guru
Hobbies - HAM Radio - New Member

Join Date: Oct 2006
Location: Vancouver (not BC) Washington (not DC) US of A
Posts: 1261
Good Answers: 12
#11
In reply to #10

Re: distance calculation between co-ordinates

11/24/2007 12:11 AM

It was about 15 years ago when I was writing some software for satellites that I discovered this. I checked it out using spherical trig and it seemed to work, although today it would take quite a bit of effort to rethink the proof for it. Of course it does use the premise that we are on a sphere rather than an oblate spheroid, and the fact that latitude and longitude are at right angles. I do know that the software all worked out in the end.

Bill

Register to Reply
Guru

Join Date: Nov 2006
Location: KnoxTN
Posts: 1485
Good Answers: 6
#12
In reply to #11

Re: distance calculation between co-ordinates

11/24/2007 9:09 AM

"Of course it does use the premise that we are on a sphere rather than an oblate spheroid, and the fact that latitude and longitude are at right angles."

All of which makes it 'good enough' for practical purposes and 'government' work!

But not quite accurate enough for geological surveys or astronomers.

Salut!

__________________
Do Nothing Simply When a Way Can be Found to Make it Complex and Wonderful
Register to Reply
Guru
Hobbies - HAM Radio - New Member

Join Date: Oct 2006
Location: Vancouver (not BC) Washington (not DC) US of A
Posts: 1261
Good Answers: 12
#13
In reply to #12

Re: distance calculation between co-ordinates

11/24/2007 1:46 PM

Stan...

I ran the problem using spherical trig last night, and have to concede that using Pythagores gives you only an approximation. I guess that if the originator of the post wants accuracy, he will have to study the math to solve the problem. I enjoyed looking at the problem though. It has been years since I have even thought about it.

Bill

Register to Reply
Guru

Join Date: Aug 2006
Posts: 4484
Good Answers: 246
#14
In reply to #13

Re: distance calculation between co-ordinates

11/24/2007 4:23 PM

Hi Sciesis2:

I did a calculation using your technique (which is the same as mine, I think) and it worked fairly well for distances of a few hundred nautical miles. I used this site for a check on accuracy.

I used these places:

Atlanta Civic Center, Georgia (Building)

Des Moines, Iowa (Populated Place)

I made a little spreadsheet to convert from degrees:min:sec to decimal degrees, and then took the average of the latitudes to find the east-west distance per degree (47.48435nm) (COS 37.68 degrees * 60nm) at that average latitude. Then I did the Pythagorean math. I came up with 642.6408 nm, and the site's figure is 642.4. For many uses, that would be close enough. Neither the site's calculation nor mine takes into account terrain effects.

__________________
There is more to life than just eating mice.
Register to Reply
Power-User

Join Date: Jun 2007
Posts: 183
Good Answers: 3
#15

Re: distance calculation between co-ordinates

11/26/2007 8:54 AM

dummies

Have you not heard of the great circle! to go from coordinate to cordinate is only 1 answer. The shortest distance is not a straight line, it is an arc that's called the great circle! The mecator maps are based upon this princlple. They are stretched in such a manner to allow you to measure a bearing and still navigate the great circle using a single bearing.

http://www.wfu.edu/biology/albatross/gcircle/calcfull.html

Register to Reply
Guru

Join Date: Aug 2006
Posts: 4484
Good Answers: 246
#16
In reply to #15

Re: distance calculation between co-ordinates

11/26/2007 2:36 PM

I suspect there is no one who has replied to this who has not heard of great circles.

The calculator for which you provided a link gives a distance of 642.92 nm (although it calculates in statute miles) for the Atlanta - Des Moines distance referenced above. My Pythagorean method provides 642.64. You'd need a quite specialized application to worry about the difference. The original posters seems to have left, but I suspect that he was looking for something quick and easy.

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

Join Date: Nov 2007
Posts: 5
#17

Re: distance calculation between co-ordinates

11/29/2007 11:56 PM

Can anybody tell me the easiest/ simple method to calculate the accurate distance between two points when latitude and longitude of two points are known.please explain with an example.

Use Haversine formula. See website:

www.movable-type.co.uk/scripts/latlong.html

Not only does distance, but also bearing.

Several examples, plus a caluclator & java code

Rhumb line navigation too.

I used the haversine formula to do handheld HP calculations

Register to Reply
Member

Join Date: Nov 2007
Posts: 5
#18

Re: distance calculation between co-ordinates

11/30/2007 1:44 AM

Can anybody tell me the easiest/ simple method to calculate the accurate distance between two points when latitude and longitude of two points are known.please explain with an example.

Use Haversine formula. See website:

www.movable-type.co.uk/scripts/latlong.html

Not only does distance, but also bearing.

Several examples, plus a caluclator & java code

Rhumb line navigation too.

I used the haversine formula to do handheld HP calculations

Register to Reply
Guru
New Zealand - Member - Interested in everything- see my Profile please APIX Pilot Plant Design Project - Member - Member Engineering Fields - Electrical Engineering - Member Engineering Fields - Power Engineering - Member Engineering Fields - Civil Engineering - Member Hobbies - Musician - Autoharp and Harmonica Hobbies - Hunting - Member Hobbies - Fishing - Member

Join Date: Nov 2007
Location: Christchurch, (The Garden City), South Island, New Zealand
Posts: 4395
Good Answers: 230
#19
In reply to #18

Re: distance calculation between co-ordinates

11/30/2007 3:33 AM

Hello ZHNG,

You appear to have an ECHO/ECHO problem, because you Posted exactly the same question that you Posted a few hours ago.

Were you hoping for two identical answers......

__________________
"The number of inventions increases faster than the need for them at the time" - SparkY
Register to Reply Off Topic (Score 5)
Member

Join Date: Nov 2007
Posts: 5
#24

Re: distance calculation between co-ordinates

12/24/2007 3:07 PM

Blink wrote: My Pythagorean method provides 642.64. You'd need a quite specialized application to worry about the difference. The original posters seems to have left, but I suspect that he was looking for something quick and easy.

Reply:

Yes, every formula has its efficiencies and limits.

I can't see why someone would be interested in

"crow flies" for vehicle travel.

To be practical, I'd use the roads network rather than

the distance the "crow flies".

We usually want to look at shortest distance versus shortest time, and assess the alternatives. Thus, giving effect to driver overclocking the posted speed limit, the real estimated time to travel would be the shortest time at posted speed limits x 90%.

The driver's objective is usually to minimize travel time rather than travel distance. A program like MapPoint gives you the choice ofshortest travel time or shortest travel distance.

Calculate travel times using posted speed limit.

Generally, simple circle calculations of "crow flies"

distances should be avoided except where no other

means of calculating distances is available. GIS

programs typically know the speed of travel on

each segment of the road network, An allowance of

20 seconds per stop sign and/or intersection for slowing down

may be programmed into MapPoint.

Railway crossings?

ArcView 9 for the desktop is another excellent program.

Use of GIS systems may require add-on modules

to do road network distance calculations, and

calculations for remote areas require time & patience.

Once any formula is plugged in, it's easy.

Register to Reply
Register to Reply 25 comments
Copy to Clipboard

Users who posted comments:

Anonymous Poster (1); Blink (3); cnpower (1); Codemaster (3); elnav (1); Hendrik (1); jrpeck (1); juliangelique (1); Sciesis2 (3); Sparkstation (4); Stirling Stan (3); ZHNG (3)

Previous in Forum: Simple Beam Calculation   Next in Forum: finding latitude an longitude of a point
You might be interested in: Distance Meters, Test Points, Access Points

Advertisement