Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8672] Android: Compass True Heading - Magnetic declination seem to be added in the opposite direction

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-06-15T17:16:53.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-12 Core
ComponentsAndroid
Labelscore, geolocation, qe-port
ReporterYuzhi Zheng
AssigneeArthur Evans
Created2012-01-23T10:24:04.000+0000
Updated2013-01-17T15:59:30.000+0000

Description

For a location like Boston, MA, the magnetic declination should be about -15. iPhone handles this correctly by subtracting 15 from the magnetic heading, giving me a true heading that is more accurate than the magnetic heading. On the other hand on both the Droid and HTC incredible I tested, the true heading actually ADDS 15 to the magnetic heading, making the true heading about 30 degrees off in the Boston area and making it more inaccurate than the magnetic heading.

Comments

  1. Eduardo Gomez 2012-04-10

    @Yuzhi Zheng Can you provide info about the environment? i.e. Titanium SDK, Android OS, device specs, reproduction steps and code. That will help to narrow down the issue and fix potential bugs quicker.
  2. Yuzhi Zheng 2012-04-10

    Titanium Studio, build: 1.0.7.201112281340 Android OS both 2.2 and 2.3 Droid running 2.2 and HTC incredible running 2.3 Using Kitchen Sink to show both magnetic heading and true heading should be enough to show the problem. Any other information I should provide?
  3. Eduardo Gomez 2012-04-10

    - Titanium SDK i.e. 1.8.2, 2.0, - Reproduction steps i.e. Goto KS demos / Phone Tab / Geolocation, Views / Map Views
  4. Arthur Evans 2012-06-12

    See test code for TIMOB-9434. Without fix, run app. Press "Get Heading" button to ensure that a true heading is available. Note the difference between the true heading and the magnetic heading. Use the NOAA website to determine the appropriate declination correction for your area: http://www.ngdc.noaa.gov/geomag-web/#declination (Hint: for Mountain View, the correction is approximately +14 degrees.) Compare this to the true heading on the device, and note that the correction is applied in reverse. That is, if the appropriate correction is 14 degrees, the true heading is showing 14 degrees *less* than the magnetic heading instead of 14 degrees more. With the fix, run the app. Note that the correction goes in the expected direction. For extra credit, or if you're a bit shaky on your map and compass skills, run the app on iOS, and note that the difference between the magnetic and true headings more or less matches the Android app post-fix. (The compass headings themselves may differ between the devices, but the difference between the two readings should be about the same--that is, a magnetic heading of 346 should correspond to a true heading of around 0, assuming you're in Mountain View in June of 2012.)
  5. Arthur Evans 2012-06-12

    Addressed in PR: https://github.com/appcelerator/titanium_mobile/pull/2373
  6. Olga Romero 2013-01-17

    Closing as fixed/ used Sample code from TIMOB-9434. Tested with: Titanium Studio, build: 3.0.1.201212181159 Titanium SDK, build: 3.0.0.GA Device: HTC-EVO 4.0.3 Note: KS is not really helpful to test this issue. Refer to TIMOB-12325

JSON Source