Database Header

The following example shows the BGL file format of a database header.

;DATABASE HEADER ********************************************************
dw0001;00 world set number (not saved to file list)
dd0004c4eabh;02 N bound 43 degrees Meter units
dd000400000h;06 S bound
dd0cf000000h;10 E bound 85 degrees 32-bit pseudo
dd0bf000000h;14 W bound
ddVOR_DATA;18 VOR_DATA
dw50;22 lowest vor freq (channel 0–199)
dw50;24 highest vor freq (108.00–117.95)
ddSYNTH_SEEDS_08;26 seeds level 8
ddSYNTH_SEEDS_09;30 seeds level 9
ddSYNTH_SEEDS_10;34 seeds level 10
ddSYNTH_SEEDS_11;38 seeds level 11

ddSYNTH_SEEDS_12;42 seeds level 12
ddSYNTH_SEEDS_13;46 seeds level 13
ddSYNTH_SEEDS_14;50 seeds level 14
ddSYNTH_SEEDS_15;54 seeds level 15
ddOBJECT_DATA;58 OBJECT_DATA
ddLIBRARY_DATA;62 LIBRARY_DATA
ddFACILITIES_DATA;66 FACILITIES_DATA
ddANCHOR_POINTS;70 ANCHOR POINT DATA
ddCOM_DATA;74 COM RADIO DATA
ddADF_DATA;78 ADF DATA
ddDYN_PATH_DATA;82 DYNAMIC OBJECT PATHS
dw3,3,2,1;86 Library id min
dw5,3,2,1;94 Library id max
ddMISC_DATA;102 MISC_DATA (iom, landme)
ddTITLE_DATA;106 TITLE AND DESCRIPTION DATA
ddMAGDEC_MAP;110 MAGVAR MAP PTR
ddEXCEPTIONS_DATA;114 EXCEPTION LIST PTR
dd0;118 spare 1
dd0;122 (not saved to file list)
dw0;126 (not saved to file list)

Important: If there is no data for any given pointer, set its value to 0.

The following table describes the components and characteristics of the BGL extended header record.

Note: If the BGL system finds the “magic number” in the offset 118 spare slot, the extended header information is used for facility and version information. This feature was added for Flight Simulator 98; earlier versions of Flight Simulator use only the basic header shown in the preceding example. Flight Simulator 98 is backward compatible with the basic header.

Name Offset, size Description
World set # 0, UINT16
North lat bound 2, SINT32
South lat bound 6, SINT32
East lon bound 10, ANGL32
West lon bound 14, ANGL32
VOR data 18, PTR32
Lowest VOR channel 22, UINT16
Highest VOR channel 24, UINT16
Seed level 8 data 26, PTR32
Seed level 9 data 30, PTR32
Seed level 10 data 34, PTR32
Seed level 11 data 38, PTR32
Seed level 12 data 42, PTR32
Seed level 13 data 46, PTR32
Seed level 14 data 50, PTR32
Seed level 15 data 54, PTR32
Object data 58, PTR32
Library data 62, PTR32
Facility data 66, PTR32
Anchor data 70, PTR32
COM radio data 74, PTR32
ADF radio data 78, PTR32
Dynamic scenery data 82, PTR32
Library minimum 86, UINT64
Library maximum 94, UINT64
Miscellaneous data 102, PTR32
Title data 106, PTR32
Magvar data 110, PTR32
Exception (inclusion) filter data 114, PTR32
Magic # 118, UINT32 =0x87654321
Reserved 122, PTR32 =0x00000000
Reserved 126, UINT16 =0x0000
File GUID 128, GUID128 Use Visual C++ GUIDGEN utility to generate this value.
Version 144, UINT32 =0x00000001
Data pointers count 148, UINT32 =N
Data pointer list *, PTR32*N
Facility2 name list 152, PTR32 See NAME_LIST
Reserved 156, PTR32
Facility2 data 160, PTR32 See OBJECT_CONTAINER

Important: The File GUID entry must be unique for each and every version of the file. This value is used to detect when the index file, which is derived from the new facility data, needs to be rebuilt. Failure to rebuild the index file can result in incorrect or outdated facility information being presented to the user.

The following table describes the primitive data types used in the database header.

Data type Description
UINT8 8-bit general-purpose data type.
UINT16 16-bit general-purpose data type.
UINT32 32-bit general-purpose data type.
UINT64 64-bit general-purpose data type.
PTR32 Pointer data type.
ENUM32 32-bit enumerated value. This data type is restricted to a very specific set of values.
GUID128 128-bit globally unique ID. Think of this data type as a computer-generated name or label. Generally, the GUIDGEN utility is used to generate this data type.
FREQ32 8-digit BCD number. The units of the number is 100 Hz. For example, a frequency of 122.250 MHz would have a value of 0x01222500; a frequency of 699.2 kHz would have a value of 0x00006992.
RWY32 32-bit number that designates the runway number or orientation, as follows:
1–36, runway numbers
37, N/S
38, E/W
39, NW/SE
40, SW/NE
STRINGZ4 Variable-length string, but with an additional requirement that the length be a multiple of 4 bytes. There should be 1-4 bytes of 0 (zero) that terminates the string, the number of 0 bytes being whatever number is required to make the total length of the string divisible by 4. If the string length is already divisible by 4 (prior to adding any 0 bytes), you must add 4 bytes of 0 to the string; that is, the string must always be followed by at least one byte of zero.

The records in the following table show the general structure of different classes of records. These records aren't meant to be used in a database, but are documented to show the common fields of each record class.

Name Size Description
IF48 (ANGL48)
Reserved UINT16 =0x0000.
Lo UINT16 Lower 16 bits of value (fraction).
Hi SINT32 Upper 32 bits of value (integer).
OBJECT_
Type ENUM32 See OBJECT_ enum list.
Size UINT32 Size of remainder of object.
Data UINT8*Size Contents is object-specific.
LOCATION_
Type ENUM32 =LOCATION_
Size UINT32 Size of remainder of object.
Latitude IF48 Meters from equator.
Longitude ANGL48
Elevation IF48 Meters (MSL).
Heading ANGL32 Pseudodegrees.
<other data> (unknown) The format of the rest of the record depends on the particular type of record.
OBJECT_NULL Commonly used to mark or terminate a sequential list of other types of records.
Type ENUM32 =OBJECT_NULL
Size UINT32 =0x00000000
OBJECT_CONTAINER Used to group a collection of related records. For example, a collection of records that make up an airport description are placed within an OBJECT_CONTAINER record.
Type ENUM32 =OBJECT_CONTAINER
Size UINT32 Size of remainder of object.
Container type ENUM32 CONTAINER_AIRPORT
CONTAINER_VOR
CONTAINER_NDB
Reserved UINT32 =0x00000000
Data OBJECT[N] Other objects in this container.
LOCATION_AIRPORT Included in the airport container object and gives the ARP lat/long as well as the field elevation data. There should be exactly one LOCATION_AIRPORT record in an airport container.
Type ENUM32 =LOCATION_AIRPORT
Size UINT32 Size of remainder of object.
ARP Latitude IF48 Meters from equator.
ARP Longitude ANGL48
Field elevation IF48 Meters (MSL).
Heading ANGL32 <unused>
LOCATION_RUNWAY Include one LOCATION_RUNWAY record for every runway (and helipad) that an airport has. Any LOCATION_NAVAIDS that follow a LOCATION_RUNWAY within an AIRPORT_CONTAINER are assumed to be related to the LOCATION_RUNWAY until a new LOCATION_RUNWAY is found. This ordering inside the AIRPORT_CONTAINER creates the relationship between localizers and ILSs and the associated runway.
Type ENUM32 =LOCATION_RUNWAY
Size UINT32 Size of remainder of object.
Center latitude IF48 Meters from equator.
Center longitude ANGL48
Center elevation IF48 Meters (MSL).
True heading ANGL32 Pseudodegrees.
Magnetic variation ANGL32 Pseudodegrees.
Length UINT32 Feet.
Width UINT32 Feet.
Runway type ENUM32 RUNWAY
RUNWAY_LEFT
RUNWAY_RIGHT
RUNWAY_CENTER
HELIPAD
Runway number RWY32 Orientation.
Surface material ENUM32 SURFACE_UNKNOWN
SURFACE_DIRT
SURFACE_CEMENT
SURFACE_ASPHALT
SURFACE_GRASS
SURFACE_GRAVEL
SURFACE_OIL_TREATED
SURFACE_MATS
SURFACE_SNOW
SURFACE_CORAL
SURFACE_WATER
Reserved UINT32 =0x00000000
LOCATION_SET Used to identify specific locations in an airport where the user might wish to place their aircraft. Currently, only takeoff locations can be identified, but in the future, this record will be used to mark parking apron tiedown locations, gate locations, and so on.
Type ENUM32 =LOCATION_SET
Size UINT32 Size of remainder of object.
Latitude IF48 Meters from equator.
Longitude ANGL48
Elevation IF48 Meters (MSL)
Heading ANGL32 Pseudodegrees
Set type ENUM32 SET_TAKEOFF
Subtype ENUM32 (Set type=SET_TAKEOFF)
RUNWAY
RUNWAY_LEFT
RUNWAY_RIGHT
RUNWAY_CENTER
HELIPAD
Number RWY32 Set type=SET_TAKEOFF) orientation
Reserved UINT32 =0x00000000
LOCATION_TOWER Identifies the location of the airport's tower and the MSL altitude of the tower viewpoint. Typically, only one of these records exists in an airport container record, but in some cases, more that one is be specified.
Type ENUM32 =LOCATION_TOWER
Size UINT32 Size of remainder of object.
Latitude IF48 Meters from equator.
Longitude ANGL48
Altitude IF48 Meters (MSL)
Heading ANGL32 <unused>
FREQUENCY Used to identify the various communication frequencies that the airport uses.
Type ENUM32 =FREQUENCY
Size UINT32 Size of remainder of object.
Frequency FREQ32
Type ENUM32 FREQ_ATIS
FREQ_MULTICOM
FREQ_UNICOM
FREQ_CTAF
FREQ_GNDCON
FREQ_CT
FREQ_CDEL
FREQ_APCON
FREQ_DEPCON
FREQ_CENTER
FREQ_FSS
FREQ_AWOS
ICAO_ID Used to identify the ICAO ID that is associated with the airport.
Type ENUM32 =ICAO_ID
Size UINT32 Size of remainder of object.
Id STRINGZ4
LOCATION_NAVAID Included in a container record. Specific types of navaids are included in specific types of container records. For example, NAVAID_VOR and NAVAID_DME types should only be used in VOR containers and the NAVAID_NDB type should be used in an NDB container. Include the NAVAID_LOCALIZER, NAVAID_GLIDESLOPE, NAVAID_SDF, and NAVAID_MARKER types in airport containers. The frequency field of a navaid of type NAVAID_TACAN is assumed to be a BCD encoding of the‘channel’. Each NAVAID_TACAN record must have an associated NAVAID_DME that specifies the VOR frequency to tune so the DME capabilities can be used in a civilian aircraft.
Type ENUM32 =LOCATION_NAVAID
Size UINT32 Size of remainder of object.
Latitude IF48 Meters from equator.
Longitude ANGL48
Elevation IF48 Meters (MSL).
Heading ANGL32 Depending on navaid type this may be unused.
Frequency FREQ32 In the case of DME and GLIDESLOPE navaids, the value of the frequency must be the same as the VOR or LOCALIZER with which it's associated.
Type ENUM32 NAVAID_VOR
NAVAID_DME
NAVAID_NDB
NAVAID_LOCALIZER
NAVAID_GLIDESLOPE
NAVAID_SDF
NAVAID_MARKER
NAVAID_TACAN
Class ENUM32 SSV_TERMINAL
SSV_LOW_ALTITUDE
SSV_HIGH_ALTITUDE
NDB_COMPASS_LOCATOR
NDB_MH
NDB_H
NDB_HH
MARKER_OM
MARKER_IM
MARKER_BC
Flags FLAG32 VOICE_ANNOUNCE
Reserved UINT32 =0x00000000
Identifier STRINGZ4
NAME_LIST Order name entries in a hierarchical fashion. Start with a FACILITY_REGION entry and follow it with all the FACILITY_COUNTRY entries that are in that region. Follow each FACILITY_COUNTRY entry with all the FACILITY_STATE entries that are part of that country, and then follow each FACILITY_STATE entry with all the FACILITY_CITY entries that are within that state's boundaries. FACILITY_AIRPORT and FACILITY_ICAO_ID entries are ordered in the list after each FACILITY_CITY entry that they are associated with. The FACILITY_AIRPORT entry precedes the related FACILITY_ICAO_ID entry. (The FACILITY_ICAO_ID name always includes the country code; for example, O'Hare is designated KORD, not ORD).
Type ENUM32 =NAME_LIST
Size UINT32 Size of remainder object.
Language ID UINT32 =0x00000409 for U.S. English. (See winnt.h for other ID values; search for"LANG_".)
String type ENUM32 =STRINGZ_ASCII
Reserved UINT32 =0x00000000
Name entry count UINT32 Number of name entries.
Name entries NAME_ENTRY [N]
Note: You must include more than one NAME_LIST record in a BGL file; at minimum, there must be two. The NAME_LIST records are sequential in the file. The last NAME_LIST record must be an OBJECT_NULL record. If there are more than two NAME_LIST records in the file, it is assumed that each NAME_LIST record has a different language ID value; this way, you can use a single BGL facility file to support multiple languages.
NAME_ENTRY See preceding description.
Type ENUM32 =NAME_ENTRY
Size UINT32 Size of remainder of object.
Facility type ENUM32 FACILITY_REGION
FACILITY_COUNTRY
FACILITY_STATE
FACILITY_CITY
FACILITY_AIRPORT
FACILITY_VOR
FACILITY_NDB
Object pointer PTR32 See OBJECT_CONTAINER.
Name STRINGZ4