Ia is there a way to get true north in cocoa touch?

I would like to define a direction moving clockwise starting from true north. Is there a way for me to get or calculate true north based on a set of lat and long coordinates?

I am interested in implementing this cocoa touch. I'm sure this is used in many applications that already exist. Any comments, pointers, advice would be much appreciated.

thanks

LDJ

0


a source to share


3 answers


Zekian is on the right track though ... Looks like you need your current long / lat and your current magnetic poles long / lat, a bit spherical geometry to figure out the magnetic output ("declination" is a word that pops up a lot) and then apply this conclusion to your current magnetic north reading. And as the Earth's magnetic field continues to move, you also need to compensate for that. Or at least suggest an update for the magnetic north long / lat.

These are the links I found along the way, but my head started spinning like the Exorcist before I could think of 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

-1


a source


if you get one set of coordinates, then another set will say ten seconds later, you can decide which direction you were traveling. (Not sure if this is exactly what you wanted)

You will need to work out the change in longitude and latitude, then use a little trigonometry and just do arctan (long / lat) (arc tan is the inverse of tan function) You will have to avoid division by 0 when the change in lat is 0. However, when the change in long or lat is 0, you know you were traveling directly north, east, south, or west.



Also, arctan is displayed in radians in most APIs, so you must divide by 180 and divide by pi to get degrees.

Edit: Is north north really not at any latitude 0? While my first impression is that this is a grid in the north, I think that because of the earth's curve and lines, the lines of longitude are drawn in parallel, creating a variation called the grid north.

+2


a source


Do you mean magnetic north?

If so, Google for magnetic variation and you get it.

0


a source







All Articles