PDA

View Full Version : Distance between 2 points


GearDown&Locked
18th Feb 2004, 06:09
Hi All

I'm seeking a valid formula for calculating the distance between 2 points on the earth globe, giving the Lat's / Lon's from both places. :hmm:

I've tried two or three formulas but when comparing results with actual charts, I always get different distances. :confused:

Can someone give me a hand here?
Thanks in advance.:ok:

SuperRanger
18th Feb 2004, 09:57
try
http://williams.best.vwh.net/avform.htm

flynverted
18th Feb 2004, 11:40
http://gc.kls2.com/

Cron
18th Feb 2004, 19:41
Departure (n.m.) = Ch.Long (min) x cos.lat

1 A flight is to be made along the parallel of latitude from A at 48 °00N 04°00'W to B at 48°00N 02°27E. Calculate the distance. (259nm)

oxford blue
18th Feb 2004, 21:10
Rhumb Line or Great Circle distance?

It makes a big difference.

SFI145
18th Feb 2004, 22:03
The great circle distance d between two points with coordinates {lat1,lon1} and {lat2,lon2} is given by:

Dist=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))

CJ Driver
19th Feb 2004, 01:22
SFI145's formula is completely correct, but for the benefit of those at the back of the maths class who may not have been keeping up, I'd add a small word about units, especially for those of you typing the formula into your favourite spreadsheet.

Your favourite spreadsheet probably does sines and cosines of angles in radians, and the formula shown works great if your Lat and Long pairs are in radians, at which point it also gives you the answer in Great Circle radians.

For those of you who started with Lat/Long in degrees, and wanted the answer in nautical miles - first convert your degrees into radians by multiplying by (pi/180), and convert the radian answer back into degrees by using the opposite (180/pi). Finally, to get from great circle degrees to nautical miles, multiply by 60.

GearDown&Locked
19th Feb 2004, 08:08
Many thanks for all the helpfull replies. :ok: :ok: :ok:

Best Regards

GDL

swh
19th Feb 2004, 09:25
The formulas above will be slightly different to charts as charts are projected onto a spheriod, normally the WGS84 ellipsopid.

The formula results above will agree directly with unprojected data, or an unprojected map.

The WGS84 ellipsoid is flatter at the poles than a perfect sphere, hence the spherical geometry answers you received above will have a small error as a result of the projection.

OzExpat
19th Feb 2004, 15:49
To add just a little to the post by CJ Driver... if you're starting with latitude and longitude in the standard format of degrees, minutes and seconds (to however many decimals), first convert it all to degrees. Then convert to radians in the way that he (or she) has described.

The conversion is simple enough, just divide the minutes by 60, then divide the seconds by 3600, then add the lot to the degrees.

If you've started with the coordinate format on a chart, it will be in degrees and minutes (to a couple of decimal places). The conversion for this is even simpler because you only have to contend with the minutes.

You might still end up with an error of a mile or more, depending on the datum used in the chart. The formula for deriving distance, as posted by SFI145 is a catch-all that should work pretty well for the WGS-84 datum, but not be all that great with any of the myriad of other datums that are available.

In any event, you might end up with a slightly different answer to that shown on a chart. This will be due to factors such as the way the distance is rounded for chart use. Also, on whether the chart distance was calculated using the actual coordinates, or the decimalised version of the same.

Tim Zukas
28th Feb 2004, 07:41
First caveat: lat-lons don't come scribed on stone tablets. The lat-lon of a given point in the US or Europe (or most anywhere else, probably) has changed over the last few decades, not because the point has moved but because we're now calculating it differently. Some places have "moved" a few hundred meters on that account. (Or farther?)

So if you want accuracy to better than, say, 10 meters you need to know which system of lat-lons you're using. Then:

Next you decide what accuracy you need. SFI145 gave the usual formula for a spherical earth, which in extreme cases will be off by twenty miles or so (since the earth isn't spherical). If that's not good enough, you can choose between (among others)

Lambert's formulas, which are fairly simple and accurate to 5-10? meters over almost any distance

Bowring's short-distance formulas, which are fairly simple and accurate to a few millimeters for points up to 100 km apart

More complicated iterative formulas that are accurate to a millimeter for points less than 19500 km apart.

You can program any of them into your pocket calculator. Or, if you just want the answer, you can use Ed Williams' site linked above, or the NGS website, which will do the iterative calculation for you, accurate to a millimeter. I think they both fail if the two points are too close to antipodal.