views:

362

answers:

3

Hello

I am would like to determine a direction moving x degrees clockwise starting on true north. Is there a way for me get or calculate true north based on a set of lat & long coordinates?

I am interested in implementing this cocoa touch. I am sure this is used in many of the applications already out there. Any comments, pointers, advice will be highly appreciated.

Thanks

ldj

A: 

Do you mean magnetic north?

If so google for magnetic variation and you will have it.

I mean true north.
ldj
+1  A: 

if you get one set of coordinates, then another set say ten seconds later, you could work out which direction you had travelled in. (Not sure if this is what you wanted)

You would have to work out the change in longitude and latitude, then use a bit of trigonometry, and simple do arctan(long/lat) (arc tan is the inverse function of tan) You'll have to avoid dividing by 0 when change in lat is 0. However, when the change in long or lat is 0 you know you have travelled directly north, east, south or west.

Also, arctan in most APIs outputs in radians so you must times it by 180 and divide by pi to get degrees.

Edit: Is true north not located at any latitude of 0? Although my first impression this was grid north, I think due to the curve of the earth and the fact lines of longitude are drawn parallel creates variation referred to as grid north.

A: 

Zekian is on the right path, though... It looks like you need your current long/lat, and the current magnetic poles long/lat, a bit of spherical geometry to figure out the magnetic derivation ("declination" is a word that pops up a lot), and then apply that derivation to your current magnetic north reading. And because the earth's magnetic field keeps moving around, you need to compensate for this too. Or atleast offer an update for the magnetic north's long/lat.

These are links I found along the way, but my head started spinning like in the Exorcist before I could come up with anything clever

http://www.nauticalissues.com/en/math1.html

http://mathforum.org/library/drmath/view/60398.html

http://mathforum.org/library/drmath/view/55417.html

http://www.ngdc.noaa.gov/geomag/magfield.shtml

http://en.wikipedia.org/wiki/Magnetic_declination

Assembler