View Full Version : bgl file structure - help needed
I'm new to this forum and hope that this is the right place to get in depth information about the bgl file structure.
My question concerns the 'Airport-subsection' - page 5 in Winfrieds great documentation 'FS X BGL File structure' which I downloaded from this website.
a) Can anyone explain me how the ICAO codes are stored. Although I read the explanation within the document on page 2, I can't figure out how to proceed.
i.e. (DWORD) '02 DC 62 81' means PAPO (how is this coded?)
b) datatype 'float': where is this datatype described?
i.e. (DWORD) '43 AC 00 00' means MagVar -16 (how is this coded?)
thank you all in advance for helping me
26 Apr 2007, 14:22
Actually Winfried explains it pretty well. It is not that easy as the format is packed. Here is my documentation on the subject and it is really much the same.
ICAO Identifiers and Region Codes
are coded in a special format. Each number and letter has a
value from 0 .. 37:
digits 0 .. 9 02 .. 11
letters A .. Z 12 .. 37
The code is calculated by starting from left: the value of the first digit/letter is multiplied by 38, then the value of the next digit/letter to the right is added, the sum s multiplied by 38, and as long as there are more digits/letters this process is repeated. When the last letter/number is added do NOT multiply by 38!!!.
The region codes have only 2 digits/letters and the result is used as such; for the ICAO identifiers for airports, ILS, VOR, NDB and waypoints there are up to 5 digits/letters, and the result is shifted left by 5 positions, i.e. multiplied by 0x20. Bits 0 .. 4 of the resulting DWORD are frequently used for other purposes. The ICAO identifiers for primary and secondary ILS in a runway record are not shifted.
I have found:
ICAO Idents are shifted
VOR/ILS Idents are shifted
Region Idents are not shifted
Airport Idents related to ILS are not shifted
Can I ask are you planning to write a de-compiler? If so there are a couple already available but if you want to write you own then I have the coded algorithms for this in SDE - these are in C# but easy enough to change to another language.
A Float is a four byte floating point number in most programming languages. In some cases this is called a single - but what it means is that the four bytes is to be treated as a floating point number. Otherwise it is going to be an integer (DWORD). Depending on the programming language you plan to use you will need to translate these into the appropriate types. Winfried is basically giving C/C++ types.
Thanks Jon for your quick response.
you're right, I'm planning to program a de-compiler. As I figured out all of these compilers that I found for free are generating XML-Files. I would like to have the data in a database, that's the reason why I want to program it by myself.
Of course there are some strange things in this bgl-files and if you are willing to give me some code snippets this would be helpful anyway. I'm also programming with C# (VS2005) so it shouldn't be a problem to read your code :)
27 Apr 2007, 13:18
SDE can provide the Bgl contents in format other than XML. If you want the information in a database then you might want to consider using the SDE Engine library. I will make that available to developers. SDE generates a tree like structure of objects that contains all the information extracted from the Bgl file. Also have you considered generating your database from the XML - there are certainly a lot of XML based databases about now so it should not be too difficult.
PM me if you would be interested in using the SDE Engine - give me some idea of what application you are planning would also be a help. On the other hand if you enjoy the propect of writing a de-compiler (it is not too easy :) ) then let me know
vBulletin® v3.8.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.