Read active ADF lat/lon?

Hi there,
Is there a way to read the latitude and longitude of the tuned NDB through execute_calculator_code or similar, without going through simconnect? The simulation variables documentation lists "ADF LATLONALT:index" but I can't seem to make it work using execute_calculator_code(). is there some other way, or must I set up a simconnect client for the sole purpose of receiving this one bit of info?

Many thanks,


Resource contributor
You can only read such structure vars via SimConnect. It is not hard to set up a SimConnect client within a gauge dll.
If you must not use SimConnect at all there is an alternate (out of the box) way.

If ADF tuned is valid and receiving then,
(using XML)
Start as Nearest Waypoint NDB search via the GPS (use a fairly high value for returns and IIRC 125nm is the max range for NDBs)
After the search is completed iterate through the results until your frequency is found, use that index (NearestNdbCurrentLine) then,
Send (NearestNdbCurrentICAO) to (WaypointNdbICAO) from there you can,
Send (WaypointNdbLatitude) to (L:Var_Lat)
Send (WaypointNdbLongitude) to (L:Var_Lon)
Send (WaypointNdbElevation) to (L:Var_Elev) * if needed

From there you can execute_calculator_code()

See Bob McElraths GPS guide book here.

It can work, I used similar for a Becker Homing gauge & a KDI 572 with a working DME hold(2)
Will be a pity if you cannot get SimConnect to work with that A:Var because it looks like the perfect A:Var for the Lat/Lon.

Building on Roman's suggestion, if you choose the XML-gps method, you can skip the ICAO transfer step if you're using FSX or P3D by utilizing the NearestNdbSelectedNdbLatitude, Longitude variables.

Thanks very much, y'all! I went ahead and used simconnect, in the end it seems the simplest. I should have clarified, I actually have no real need not to use simconnect, I just asked because I wondered if there was just some easy trick that to read that variable that I was unaware of (I'm pretty new to this), but I really appreciate the sincere and creative answers to the question I actually asked, it makes me like this forum! :)