PPRuNe Forums

PPRuNe Forums (https://www.pprune.org/)
-   Tech Log (https://www.pprune.org/tech-log-15/)
-   -   Geometry/geography question (https://www.pprune.org/tech-log/10127-geometry-geography-question.html)

Squawk 8888 14th June 2001 18:18

Geometry/geography question
 
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

Bally Heck 14th June 2001 21:10

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).]

Squawk 8888 14th June 2001 21:55

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

Zeke 15th June 2001 02:27

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 !



Bally Heck 15th June 2001 14:32

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

ft 15th June 2001 14:50

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

Bally Heck 15th June 2001 20:54

Thanks ft. I'll take a look.

supermunk 15th June 2001 22:59

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.

Checkboard 16th June 2001 06:46

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

Squawk 8888 16th June 2001 07:16

Many thanks to all. Once I have something useful, I'll make an announcement in the Private Flying forum.

------------------
Per dementia ad astra

Zeke 17th June 2001 03:01

Bally Heck,

Dont have a harmonic mannetic model in excel, just a lookup table with a great circle calculator.

Send me an email if you woul like a copy.

Z

Bally Heck 17th June 2001 07:35

Thanks Zeke
I found something in the Aviation formulary above. A wee gem of a site.

BH

Zeke 18th June 2001 08:45

Bally,

I thought you already knew of this site as you have posted word for word Ed Williams great circle calculations, you have either copied it from the web site, or the chaper in the book he wrote.....

It would be nice to reference things

Z

Bally Heck 18th June 2001 16:05

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.

OverRun 19th June 2001 21:30

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/


All times are GMT. The time now is 04:03.


Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.