4

The android.hardware.GeomagneticField class has a method getDeclination which we can use to find true north. All examples I've seen on StackOverFlow and other sites add this value to the magnetic north to find the true north, like this:

True north = Magnetic North + Declination

But a post in this question suggests this may be wrong: Using orientation sensor to point towards a specific location

Unfortunately, no-one has commented or voted on the post.

The Android documentation says that at positive value "means the magnetic field is rotated east that much from true north". And this page has a few figures which shows the same: "Positive declination - magnetic north is east of true north". In other words, declination is defined as this:

Declination = Magnetic north - True North

Rearranged to find true north based on magnetic north:

True north = Magnetic north - Declination

So, it is correct to add or subtract the declination? And if it is correct to add it, why?

Community
  • 1
  • 1

1 Answers1

6

I got here because I was asking the same question myself. I am researching this at this very moment, so I may be slightly mistaken.
You want the TRUE north, the one that is unaffected by your location (to be more exact, you location is affected by the magnetic fields of earth, link).
When navigating, you are supposed to ADD or SUBTRACT declination, depending (I think) on your location when you use the compass, that is, is the magnetic north east or west to the true north? east\west declination.

The class "GeomagneticField" can calculation that offset for you, and if I understand the method's description correctly, it also tells you wether you have east or west declination: positive is how much east you are, negative for how much west you are.
1) Get your heading, that is you relative to magnetic north (obtained by magnetic sensor)
2) Get your declination

if declination is positive, your magnetic north is east to the true north, so your heading is "to the right" by (some degrees) from the true north! we ADD, hence: heading (magnetic) + declination = true north

if declination is negative, your magnetic north is west to the true north, so your heading is "to the left" by (some degrees) from the true north! we SUBTRACT (the absolute value!), hence: heading (magnetic) - declination = true north.
nice! we can actually see that subtracting absolute value is just like adding the negative degrees, so i guess you can always just add the declination to your heading.

So that's that for you, the why and the what (bottom line i'd say add). Like I said, i just cross-referenced a few pages to get that answer (the above mentioned and also this one, so please double check my links and verify my answer :)

Community
  • 1
  • 1
yoad w
  • 197
  • 2
  • 10