Hello, Is there a way to get the magnetic Variation anywhere in the world? I
know I can read the MAGVAR Simvar but it provides the magnetic variation o ly
at the current aircraft position. For my FMC, I would like to have the
magnetic Variation at my destination airport that may be thousands of miles
away… Thanks for any help.
If you’re in JS, you can use MagVar.getMagVar(lat, lon). I’m not sure that an
equivalent exists in WASM at this time, yet.
I am in JS, this will be perfect for me. Thank you
Wouldn’t that be Facilities.getMagVar(lat, lon)? You need a facility listener
(JS_LISTENER_FACILITY) registered in the instrument as well prior to calling
it. If you use [msfs-avionics](https://github.com/microsoft/msfs-avionics-
mirror) you have MagVar.getMagVar.
Yes, you’re absolutely right! That is 100% correct, my apologies.
No, I don’t use msfs-avionics. In that situation, where can I find Facilities
in order to invoke Facilities.getMagVar?
First you need to register a JS_LISTENER_FACILITY somewhere in your instrument
(you will have already done that if you’re using facility/nav data for
example)… if you don’t have one, something like:
1. RegisterViewListener('JS_LISTENER_FACILITY', null, true);
Then you can simply call Facilities.getMagVar(lat, lon);. Registering the
facility listener injects Facilities into the global scope.
OK, thanks, it works perfect now