Geometry/geography question
Guest
Posts: n/a
Hi all,
I'm planning to write a flight planning program and one of the features I want to add is the ability to take a pair of lattitude/longitude coordinates and and turn them into a bearing and distance, or vice versa. I fugure that can be useful when setting up the aerodromes. I know how to do it with a flat surface, but unfortunately the designers of this planet didn't think to simplify the navigation process (I'll have to have a word with Slartibartfast about that). So, does anybody out there know the formulae or where I can find them?
Cheers.
------------------
Per dementia ad astra
I'm planning to write a flight planning program and one of the features I want to add is the ability to take a pair of lattitude/longitude coordinates and and turn them into a bearing and distance, or vice versa. I fugure that can be useful when setting up the aerodromes. I know how to do it with a flat surface, but unfortunately the designers of this planet didn't think to simplify the navigation process (I'll have to have a word with Slartibartfast about that). So, does anybody out there know the formulae or where I can find them?
Cheers.
------------------
Per dementia ad astra
Guest
Posts: n/a
You've asked for it
Some great circle formulae:
The great circle distance d between two points with coordinates
{lat1,lon1} and {lat2,lon2} is given by:
d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))
a mathematically equivalent formula, which is less subject to rounding
error for short distances is:
d=2*asin(sqrt((sin((lat1-lat2)/2))^2 +
cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))
And...
The initial course, tc1, (at point 1) from point 1 to point 2 is
given by:
if sin(lon2-lon1)<0
tc1=acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
else
tc1=2*pi-acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
endif
Intermediate points {lat,lon} lie on the great circle connecting
points 1 and 2 when:
lat=atan((sin(lat1)*cos(lat2)*sin(lon-lon2)
-sin(lat2)*cos(lat1)*sin(lon-lon1))/(cos(lat1)*cos(lat2)*sin(lon1-lon2)))
(not applicable for meridians. i.e if sin(lon1-lon2)=0)
Of course that's just of the top of me head (yea right) so check it carefully. No liability taken if you run out of fuel.
Oh nearly forgot....these tracks are true. If you want magnetic then I suggest you take the average variation between the two points and add or subtract them.
Happy programming :-)
[This message has been edited by Bally Heck (edited 14 June 2001).]
[This message has been edited by Bally Heck (edited 15 June 2001).]
Some great circle formulae:
The great circle distance d between two points with coordinates
{lat1,lon1} and {lat2,lon2} is given by:
d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))
a mathematically equivalent formula, which is less subject to rounding
error for short distances is:
d=2*asin(sqrt((sin((lat1-lat2)/2))^2 +
cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))
And...
The initial course, tc1, (at point 1) from point 1 to point 2 is
given by:
if sin(lon2-lon1)<0
tc1=acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
else
tc1=2*pi-acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
endif
Intermediate points {lat,lon} lie on the great circle connecting
points 1 and 2 when:
lat=atan((sin(lat1)*cos(lat2)*sin(lon-lon2)
-sin(lat2)*cos(lat1)*sin(lon-lon1))/(cos(lat1)*cos(lat2)*sin(lon1-lon2)))
(not applicable for meridians. i.e if sin(lon1-lon2)=0)
Of course that's just of the top of me head (yea right) so check it carefully. No liability taken if you run out of fuel.
Oh nearly forgot....these tracks are true. If you want magnetic then I suggest you take the average variation between the two points and add or subtract them.
Happy programming :-)
[This message has been edited by Bally Heck (edited 14 June 2001).]
[This message has been edited by Bally Heck (edited 15 June 2001).]
Guest
Posts: n/a
Thanks Billy- these should be dandy. I'm planning to set it up to input all parameters in degrees true, plug in the local variation and spit out compass headings, IOW the way most PPLs get trained to do on paper.
------------------
Per dementia ad astra
------------------
Per dementia ad astra
Guest
Posts: n/a
Squawk 8888,
I have done this before, it is not as easy as it initially appears.
Make sure you use the correct ellipsoid (WGS84 is fairly standard).
The magnetic model of earth, if you want to interpolate between points its fairly easy, writing a complete harmonic model of the magnetic field is not that easy.
If you would like to have a excel spread sheet to verify the results of your bearing distance stuff let me know, I could also email you some delphi code if your feeling lazy !
I have done this before, it is not as easy as it initially appears.
Make sure you use the correct ellipsoid (WGS84 is fairly standard).
The magnetic model of earth, if you want to interpolate between points its fairly easy, writing a complete harmonic model of the magnetic field is not that easy.
If you would like to have a excel spread sheet to verify the results of your bearing distance stuff let me know, I could also email you some delphi code if your feeling lazy !
Guest
Posts: n/a
Zeke
Do you have a magnetic earth model? I would be fascinated to see it especially in excel.
Also, does anyone know where a comprehensive database of intersections, navaids and airports exists. I compiled a partial european one a few years ago fo nav software but of course things move on and I suspect it's a little out of date now.
Bally
Do you have a magnetic earth model? I would be fascinated to see it especially in excel.
Also, does anyone know where a comprehensive database of intersections, navaids and airports exists. I compiled a partial european one a few years ago fo nav software but of course things move on and I suspect it's a little out of date now.
Bally
Guest
Posts: n/a
Bally Heck,
here is a database that should be fairly close to the latest ARINC cycles. IIRC, it is made by flight simulator users by superimposing all updates on top of a reasonably recent ARINC cycle. The info is in there, just gotta figure out the format I guess.
http://members.home.net/pgnav/
Cheers,
/ft
here is a database that should be fairly close to the latest ARINC cycles. IIRC, it is made by flight simulator users by superimposing all updates on top of a reasonably recent ARINC cycle. The info is in there, just gotta figure out the format I guess.

http://members.home.net/pgnav/
Cheers,
/ft
Guest
Posts: n/a
There is a NOAA site that has a downloadable program to give variation for anywhere in the world to the latest magnetic model. Unfortunately it is a DOS program that only does one position at a time. If you do a search you should come up with it. Hope that this helps.

Joined: Aug 1998
Aviation Qualifications: ATPL
Posts: 6,623
Likes: 847
From: Ex-pat Aussie in the UK
You might want to look at Ed Williams's Aviation Formulary V1.30, which includes a large amount of navigation and aviation formulae, in programming formats.
------------------
Tech Log forum moderator
------------------
Tech Log forum moderator
Guest
Posts: n/a
Zeke
Not deliberate plagiarism. Just a file on my computer from at least 6 years ago when I was doing some nav stuff. No reference attached so no way of attributing it and no idea where it came from. Actually thought it might have been from a book called I think "The Calculator at Sea" or something along these lines where I discovered most formula but apparently not.
See the "Yea right" disclaimer.
Not deliberate plagiarism. Just a file on my computer from at least 6 years ago when I was doing some nav stuff. No reference attached so no way of attributing it and no idea where it came from. Actually thought it might have been from a book called I think "The Calculator at Sea" or something along these lines where I discovered most formula but apparently not.
See the "Yea right" disclaimer.
Guest
Posts: n/a
Squark 8888,
Once your programme is up and running in alpha (or is it beta) mode, this site could provide a useful cross-check (and does a nice map as well):
http://gc.kls2.com/
Once your programme is up and running in alpha (or is it beta) mode, this site could provide a useful cross-check (and does a nice map as well):
http://gc.kls2.com/




