SIMCONNECT_DATA_FACILITY_AIRPORT does not contain region

Hi again, sorry to disturb you with more questions! It is very unfortunate
that the SIMCONNECT_DATA_FACILITY_AIRPORT class does not contain the region.
Since all the other navaids like SIMCONNECT_DATA_FACILITY_WAYPOINT,
SIMCONNECT_DATA_FACILITY_NDB and SIMCONNECT_DATA_FACILITY_VOR inherit from it,
we could get the region for all these facilities it is was there. The problem
is uniqueness. As I understand it, region + ident makes something unique. If
you get a few vors using RequestFacilitiesList or SubscribeToFacilities and
want to get more details about them, then you can call RequestFacilityData (or
_EX1) but if you don’t have the region you are not guaranteed to get a unique
response. Would it be possible to add region to
SIMCONNECT_DATA_FACILITY_AIRPORT? Or is there a better way to achieve this?
Since it is not possible to get all vors for example at once (which would be
best!) like you can do with airports, you have to subscribe or search nearby
vors and that search just return basic data so you have to make another call
to the the details for each of them. A related problem exists when you want to
create a flight planning tool. You’ll need all the items (vors, waypoints
etc.) between origin and destination to be able to select a good route but you
cannot get them in advance until you fly to them??? Is there a solution for
that?

Hi, a couple of months later :hourglass: :smiley:… In the thread WASM Facility Subscription Does Not Return Region, below answer is given but it seems impossible to extract the region using C#:

Hi Can you check in the Icao field, both information should be in there. This
is a char[9] field where:

  • Ident is located from 0 to 5
  • Region is located from 6 to 9

Best Regards Maxile / Asobo

In C#, the SIMCONNECT_DATA_FACILITY_AIRPORT class is defined as below. It is not possible to extract the region from the field, maybe because Icao is null terminated and therefor hiding the region from the marshalling logic? How can I retrieve the region from the Icao field using C#?

[StructLayout(LayoutKind.Sequential, Pack = 1)]
public class SIMCONNECT_DATA_FACILITY_AIRPORT
{
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)]
    public string Icao;

    public double Latitude;

    public double Longitude;

    public double Altitude;
}

Hello @swede001

It is possible to retrieve the region in C# but it’s not very straight forward indeed.

SIMCONNECT_DATA_FACILITY_AIRPORT tmp = (SIMCONNECT_DATA_FACILITY_AIRPORT) data.rgData[i];

IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(tmp));
Marshal.StructureToPtr(tmp, ptr, false);

byte[] ident = new byte[8];
byte[] region = new byte[8];
Marshal.Copy(ptr, ident, 0, 5);
Marshal.Copy(ptr, region, 6, 2);

string s1 = System.Text.Encoding.UTF8.GetString(ident);
string r1 = System.Text.Encoding.UTF8.GetString(region);

Marshal.FreeHGlobal(ptr);

I have logged an issue for this so we can streamline this a bit.

Regards,
Sylvain

2 Likes

I have this problem where i can get the ILS ICAO and region of a default airport but returns empty from a mod airport. Had this problem before?

Lots of scenery developers break the link between the runway and the ILS. It needs this element Runway Definition Properties

Do you know if there’s a way to get the ILS properties from the vanilla airport via simconnect even though an airport addon is installed into that ICAO?

The workaround I’ve used a few times is to check the approaches for that runway for an ILS approach, and grab the ILS from the origin facility for the final leg.

Interesting, i’ll try that, thanks!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

Hello @here,

In SU14 (currently in flighting), the region has been added to SIMCONNECT_DATA_FACILITY_AIRPORT.

You can check the related documentation here.

Regards,
Boris

2 Likes