PDA

View Full Version : Co-ord Calculator

O\ZON
17th Sep 2005, 20:01
PPruners.
Anybody out there know the formula to calculate distance/track between two WGS84 co-ordinates

rgds
O/z

No_Speed_Restriction
17th Sep 2005, 20:07
http://williams.best.vwh.net/gccalc.htm

too much toulouse
19th Sep 2005, 08:36
Visit http://www.naco.faa.gov/index.asp?xml=naco/online/compsys

Tim Zukas
20th Sep 2005, 01:19
You asked for the formula-- is that what you meant? There are a couple of websites that will do the calculation for you, but if it's actually a formula you want there are different ones depending on your required accuracy (and the distance between your two points).

Most of (all?) the better websites use Vincenty's formulas, and the NGS site has a pdf showing them. But I'm guessing you're looking for something less involved.

enicalyth
20th Sep 2005, 09:07
Formula is cos d = (cos a * cos b) + (sin a * sin b * cos c)

The text in my opinion is HMSO Admiralty Manual of Navigation. In this manual there is the Andoyer-Lambert method which allows for a spheroidal earth. Elsewhere there are petty annoyances when because of historic reasons to do with lack of electronic calculators some formulae deliberately equate sin 1' with 1' but these are easy to strike out and replace. Anyway the induced errors are small.

Any text on spherical trigonometry will do.

Here is an example based on Sydney  Heathrow. It introduces the notion of co-latitude, the angular distance from a Pole whereas latitude is the angular distance from the equator. By convention the North Pole is used so if Heathrow is latitude 51* 28.6 its colatitude is subtracted from 90* to yield 38* 31.4 ---- colatitude is 90 minus Latitude in the Northern Hemisphere.

Aha! But Sydney is in the Southern Hemisphere. No problem! By convention Southern Latitudes are negative. The colatitude formula still works!!

By convention East Longitude is positive, West Longitude is negative. The important thing is the absolute value of the difference--- 151* 10.2  (-000* 27.5) =
151* 37.7--- by absolute value I mean to ignore the sign of the answer if it is negative. Some people also call this the algebraic value?

Right done and dusted. Knock up a spreadsheet. Oh! Spreadsheets use radians not degrees. Okay there are 2pi radians in a circle.

a) Colat SYD 2.163161 radians
b) Colat LHR 0.672359 radians
c) Difference Longitude 2.646414 radians
d) Angular distance SYD-LHR

If you want to ignore spheroidal effects and just concentrate on a purely spherical earth

Then cos d = (cos a * cos b) + (sin a * sin b * cos c)

Thus d = 2.671350 radians = 153.057061 degrees = 9183.424 minutes (i.e. nautical miles)

Taking into account spherical effects and sophistry the answer is 9188nm.

Good enuff for me, uses schoolboy maths and I can program my hand held calculator.

Bearing is even easier!!!!

The formula is sin(a) / sin(A) = sin(b) / sin(B) = sin(c) / sin(C).

A, B, and C are the angles at the corners of a spherical triangle with for convenience B at the N Pole. a, b, and c are the angular distances or lengths of the sides with "a" opposite A, "b" opposite B and "c" opposite C.

In spherical mathematics distances are angular measurement in degrees or radians so side BA = c and side BC = a are colatitudes. Side AC = b the distance you work out with the cosin formula in my previous answer.

Now you know all three sides "a,b,c" and one angle "B" which is the difference in longitude. Therefore b/sinB is known and since you know both "a" and "c" you can calculate angles "A" and "C" in turn. Because we are talking about great circles the bearing along such a path changes slightly with every instant. Unlike a rhumb line. So apart from start and finish the bearing Sydney to London does not have fixed values.... re-calculate it for every waypoint.

A word of warning, because the sides of a spherical triangle are curved the sum of all three angles does NOT equal 180 degrees like it does in a straight sided triangle.

If you have any trouble just sing out or pm me. I'm here to help.

Best Rgds

The "E"

O\ZON
29th Sep 2005, 21:37
Ppruners... thanks for the links

Enicalyth... Wow.. U completely lost me

Tim Zukas... what i actually want to do is build the take off cone using simple co-ords formulas. ie. Using runway heading, and the co-ords for the rwy end, i want to build the takeoff cone. Such that when a notam mentions an obstacle at a particular co-ord position, I can enter it into an excel macro to check if it is inside the cone or not.
adding a step of complexity, i want to add a turn (speed + heading change) to my cone, ad do the same as above.

Rgds
O\z

Tim Zukas
30th Sep 2005, 17:32
So you don't need accuracy to the millimeter-- a meter error is okay with you? And you only care about points up to 20-30 km apart?

The haversine formula might work for you, especially if all your calculations are from the same initial point. I'll see how accurate it is-- what's your latitude?