Anyone has had success with RequestFacilitiesList (airports)? Always HTSE returned

Dear all,

I am trying to get the start and destination airport ICAO code, as sampled at the very beginning and end of the flight.

So far I did experiments (with the SimvarWatcher) with the simulation variables NAV IDENT, ADF IDENT, NAV NAME and the like. However I was only able to actually get some value at all with the GPS APPROACH AIRPORT ID, but only once I enabled “Approach” in the given aircraft’s autopilot system - but I need a (more or less) reliable way to get the (closest) airport without the pilot having to do any interactions with either ATC and/or the autopilot / navigation systems.

So I have SimConnect_RequestFacilitiesList a try. But I get the felling that I am either doing something wrong, or the functionality is simply not correctly implemented within FS2020:

When I do a request like

::SimConnect_RequestFacilitiesList(d->simConnectHandle, ::SIMCONNECT_FACILITY_LIST_TYPE_AIRPORT, StartAirportList);

I do get data back in my “dispatcher” (callback) function. It seems that with each reply you get back information (ICAO, lat/lon/alt) for exactly one airport (only), as the rgData “array” in SIMCONNECT_RECV_AIRPORT_LIST is a “fixed size array” with exactly one (1) element:

rgData[1]

Where the element of the array rgData is of type: SIMCONNECT_DATA_FACILITY_AIRPORT

That’s fine for me, because the inherited struct SIMCONNECT_RECV_FACILITIES_LIST contains additional members, which basically tell you that you are “receiving the i-th element out of total N elements”:

dwREntry  // the i-th entry
dwOutOf   // total number of fascilities

When stepping through my code with the debugger my dispatcher is indeed called 30 times, and the dwOutOf member indicates exactly this:

Now here is the problem:

I get 30 times the same airport (ICAO “HTSE”), with the same coordinates:

SIMCONNECT_RECV_ID_AIRPORT_LIST: array size: 1243 item: 0 out of: 30 ICAO: HTSE
SIMCONNECT_RECV_ID_AIRPORT_LIST: array size: 1243 item: 1 out of: 30 ICAO: HTSE
SIMCONNECT_RECV_ID_AIRPORT_LIST: array size: 1243 item: 2 out of: 30 ICAO: HTSE
SIMCONNECT_RECV_ID_AIRPORT_LIST: array size: 1243 item: 3 out of: 30 ICAO: HTSE
etc.
SIMCONNECT_RECV_ID_AIRPORT_LIST: array size: 1117 item: 29 out of: 30 ICAO: HTSE

And what’s more: that airport is not anywhere near the airport where my aircraft is sitting at the moment I do those requests: I am sitting at Zurich airport (LSZH - in Switzerland) with lattitude / longitude 47° 27’ 38" N / 8° 33’ 0" E, which is far, far away from the given latitude / longitude -4.05 / 37.79 - which places HTSE into Africa (somewhere “near” the Kilimanjaro mountain)!

So why am I getting 30 times the same airport information of an airport which is not even on the same continent (Africa) than the one my aircraft is sitting on the runway (Europe)?

Or does anyone spot some stupid mistake I am making in my brain here?

→ Did anyone successfully retrieve the “list of fascilities” (airports, navigation points, …) near and around the user aircraft?

Here is another memory dump:

I get 30 times the same “HTSE” airports (with the same coordinates, which correctly place it into Africa).

Note that the memory address of the rgData “array” (with a fixes size of 1) changes each time:

which indicates that I am not reading the same element over and over again (so those are really 30 distinct replies that I am getting from FS2020). But again, always with the same ICAO code HTSE…

And for the record: just now I placed my aircraft at Nanwalek (KEB), which turned out to be some lovely place in Alaska:

And yet I still get the same HTSE airport back (always 30 times, it seems). Now if some developer was a bit lazy here and took some “shortcuts”, at least there would be some weird humour behind “HTSE”: HTSE airport is called…

… drum rolls…

Same Airstrip!

( 4°03′13″S 37°47′25″E )

So we get the same Same Airstrip over and over again, 30 times! If this is no coincidence, that can’t be… no way!.. Asobo, you’re reading this? :wink: Something tells me that there is a “Nyah, nyha, nyah hahahaa!”-kind of comment somewhere in that RequestFacilitiesList implementation… :wink:

Zendesk’ed. Unless someone spots the error in my thoughts…

And another desperate attempt of getting some meaningful values: I replaced the above SimConnect_RequestFacilitiesList call with SimConnect_SubscribeToFacilities.

Oh… wait!

Now that is interesting: while I initially (right after the call) do get the same Same Airstrip (HTSE) 30 times after that (like after 10 seconds or so, have to verify again) I actually do get meaningful results!

I have yet to verify those returned ICAO codes (I just received LFHE, which, yes, makes way more sense, given my current location) and as I “slew” over the landscape I do get more entries (like one more at a time, not a “burst” of 30 entries).

→ Could it me that some “debug / test code” was left in production code? :wink:

Anyway, at least that gives us something to work with (as a workaround I will now stick with the “subscribe” variant and simply ignore any entry with ICAO HTSE - which implies that my software won’t work at the Same Airstrip - but oh well ;))

… but unfortunately only so little: seems like airports are only reported sparsely. And so far I couldn’t get SimConnect to report the very airport I was nearby, and even landing on. sigh

It seems like this whole “get facilities list” functionality is not really working reliably. At least not as far as airports are concerned, or so it seems.

Ironically I also tried the “Get nearest airport list” in the ATC menu, and while all nearby airports where shown there (sorted in order of distance) that didn’t seem to have any effect on the returned airports, as returned via SimConnect…

What are your experiences? Anyone else got better results so far?

So I am not the first one to stumble over this issue:

UPDATE:

And another one:

I wish I knew what on earth you are talking about! Too technical for me but good luck finding your answer.

1 Like

Note to myself: seems like I have to look into this „GPS WAYPOINT simulation variable topic again:

But geez, how difficult can it be really to provide a proper API to return the entire flightplan (or at least start and endpoint thereof). Seems like people are asking about this for years, e.g. also here:

Or here:

But quick experiments with the latest SimvarWatcher (which should now support string variables) of SDK 0.12.0 returned empty values for the various GPS PREV/NEXT ID variables. Guess I have to try again with my own code…

We are not alone:

http://www.prepar3dtest.com/forum/viewtopic.php?t=137147

I gave it another try, and also based on some other posts linked above I actually managed now to get the expected GPS WAYPOINT identifiers (ICAO codes):

This worked both with an A320neo with a “IFR Low Altitude” flight plan from LSZH to LSGG (Zurich to Geneva) as well as an Aviat Pitts Special (“as simple as it gets - no GPS, no autopilot”) from some tiny, random airport LFGB with a VFR flightplan to…

Holy moly! Is this some beautiful area: LFGB


UPDATE:

Even the crash sites look gorgeous in this area :slight_smile:

Sorry… where was I? :wink:

A yes, the GPS WP NEXT/PREV simulation variables also worked with an Aviat Pitts Special and a simple VFR flight plan from LFGB to another random, tiny airport LSGR (so no “active GPS system” required in the aircraft).

Including access to the waypoint coordinates that is all I need for my requirements, to figure out the starting and ending location (ICAO code) respectively the information whether the aircraft flew anywhere “near” of any of those waypoints…