# FSX BGL Airport Records

#### scruffyduck

Staff member
FSDevConf team
Resource contributor
I've started a new thread with this question as the one related to BGLAnalyzeX is becoming very long.

I think I was up too late last night and my brain is not working very well today

In Winfried's document on BGL format he gives formulas for converting the lat/lon values:

(double) Lon = (DWORD) Lon * (360.0 / (3 * 0x10000000) – 180.0
(double) Lat = 90.0 - (DWORD) Lat * (180.0 / (2 * 0x10000000)

I seem to see missing brackets and also these do not produce any sensible numbers for me - could some kind soul take pity and give me the Math 101 on this please?

Also I noted the dicussion on AirportTestRadius - am I correct in that this is used by the compiler but the information is not stored in the bgl? If not where is that information in the record? Second is TrafficScalar new and again where is it in the airport record please?

thanks guys

#### Javier

Hi Jon,

From the BGLXML code I use:

Code:
``````        private double fsLat2Lat(UInt32 fsLat)
{
double f = (((double)fsLat) * 180) / 536870912; //MAXSOUTH;
if (f > 90.0)
return -((f - 180) + 90);
else
return 90 - f;
}
private double fsLon2Lon(UInt32 fsLon)
{
double f = (((double)fsLon) * 360) / 805306368; //MAXEAST;
return f - 180;
}``````

It seems to work

Regards,
Javier.

#### scruffyduck

Staff member
FSDevConf team
Resource contributor
Thanks Javier

I will give that a try

#### arno

Staff member
FSDevConf team
Resource contributor
Hi Jon,

So combining that information it seems like the brackets should be like this (which looks familiar from the stuff I looked at before):

Code:
``````(double) Lon = (DWORD) Lon * (360.0 / (3 * 0x10000000)) – 180.0
(double) Lat = 90.0 - (DWORD) Lat * (180.0 / (2 * 0x10000000))``````

Also I noted the dicussion on AirportTestRadius - am I correct in that this is used by the compiler but the information is not stored in the bgl? If not where is that information in the record? Second is TrafficScalar new and again where is it in the airport record please?

Yes, that is correct. The AirportTestRadius is only used by the compiler to generate warnings. That must also be why Winfried uses a default value for it in his decompiler (and big airports thus start giving such errors).

I have not looked at the TrafficScalar though, I would imagine it is in the BGL file somewhere. Or else it looks like a parameter that is not really used.

#### scruffyduck

Staff member
FSDevConf team
Resource contributor
I have not looked at the TrafficScalar though, I would imagine it is in the BGL file somewhere. Or else it looks like a parameter that is not really used.

Thanks Arno - It's not in the primary airport record as far as I can see but I'm not through everything in the other airport records yet so it might be there

#### jvile

jon

Both the traffic scaler and test radius is new for FSX.

I have also noted that warnings are given for the test radius at small airports when compiling so I started using 5000M as a standard for all compiled airports. That number takes care of airports like Halifax which gave me warnings all the way up to Atlanta when I added the 5th runway way south of the ARP.

Scaling is a AI Traffic scaler used when developing Flightplans with the TrafficDatabaseBuilder.

It tells the compiler how heavily to schedule traffic at each airport. It has no effect at runtime. It's only used when the traffic database is created.

It appears to do nothing in the header of a compiled airport because it is used when the Flightplan is compiled although the FP compiler needs that piece of data in the airport record to create the flight plans with the TDB.

The end result is that 30 percent parking stays vacant on startup even though a compiled FP overloaded the parking for that airport.

#### scruffyduck

Staff member
FSDevConf team
Resource contributor
Thanks Jim

#### osman

Hi,
in the description there are indeed some brackets missing (not in the program code ).
The TrafficScaler is stored in the Airport record within the DWORD added in FS X at the end of the fixed part of that record. Apparently MS has used always the same value, but developpers might want to change that.

#### scruffyduck

Staff member
FSDevConf team
Resource contributor
Hi,
in the description there are indeed some brackets missing (not in the program code ).
The TrafficScaler is stored in the Airport record within the DWORD added in FS X at the end of the fixed part of that record. Apparently MS has used always the same value, but developpers might want to change that.

Ah is that the extra four bytes which seem to be in the FSX airport record compared to the FS9 record?

#### DougMatthews

Hi,
in the description there are indeed some brackets missing (not in the program code ).
The TrafficScaler is stored in the Airport record within the DWORD added in FS X at the end of the fixed part of that record. Apparently MS has used always the same value, but developpers might want to change that.

Up to FS9 we used a hardcoded ratio of parking spots to AI traffic. For FSX we exposed a scalar to allow throttling AI traffic at certain airports. There were some airports, in Russia notably, but also elsewhere, that the combination of many parking spots and a minimal taxiway infrastructure (or choke points) resulted in gridlock. The TrafficScalar allows us to help eliminate this problem.

-Doug

#### scruffyduck

Staff member
FSDevConf team
Resource contributor
Hi Doug

So the Scalar is the extra DWORd in the Airport Record?

Ah! - I should read the posts above more carefully - that is what Winfried is saying

Am I right in thinking that the scalar value is the value in that DWORD /65536???

Thanks

Last edited: