9037441778
Magnetic declination being "the direction of the horizontal component of the magnetic field measured clockwise from north" according to MagneticField(1), it must be substracted, not added, from true bearings in order to obtain the corresponding magnetic bearings. Example illustrating the bug: Start at KSFO, open Equipment -> GPS Settings, enter KHTH as the destination and click on "Search". Before the bug fix, the dialog gives a bearing of 85, whereas the correct magnetic bearing is 58. Digging a bit further, the true bearings/azimuths for the shortest path (geodesic line) from KSFO to KHTH are approx. 71.5 at KSFO and 73.8 at KHTH. This can be verified with two independent libraries (GeographicLib and PROJ.4): % echo "37d37'08N 122d22'30W 38d32'45N 118d38'00W" | \ GeodSolve -i 71.44943076 73.75785283 343987.398 % echo "37d37'08N 122d22'30W 38d32'45N 118d38'00W" | \ geod +ellps=WGS84 -I -f '%0.3f' 71.449 -106.242 343987.398 (-106.242 + 180 = 73.758: -106.242 is the "back azimuth" at KHTH for this path) The bearing of 85 given by the code in gui/dialogs/gps.xml before this commit is indeed 71.5 + magnetic declination at the starting point (KSFO), whereas it should be 71.5 - magnetic declination. Another, more experimental way: Start FlightGear with: fgfs --aircraft=ufo --disable-real-weather-fetch \ '--metar=KSFO 070956Z 36000KT 10SM FEW023 11/07 A2977 RMK AO2 SLP080 T01060067' \ --lat=37.61867421 --lon=-122.37500761 --heading=71.45931 (just in case wind influences the ufo, I have no idea whether this is the case or not...) During your flight, progressively increase your heading (as seen in the HUD, i.e., true heading) so that it smoothly changes from 71.5 at KSFO to 73.8 at KHTH. You should arrive pretty close to KHTH, whereas the initial heading of 85 given by the GPS Settings dialog is way too high, be it interpreted as a magnetic heading (which was visibly the intention---it would be nice to write that in the dialog BTW) or as a true heading (in which case the result is even further from the correct value). |
||
---|---|---|
.. | ||
dialogs | ||
icons/Humanity | ||
images | ||
styles | ||
cursor-spin-ccw.png | ||
cursor-spin-cw.png | ||
menubar.xml | ||
menubar.xml.alt |