Jump to content
Sign in to follow this  
Guest Testili

Reading data from .bgl

Recommended Posts

Guest Testili

Hi folks,I'm a real newbie when it comes to .bgl. For bad luck it's the only way for me, to obtain airport informations, like lat/lon of runways (or is there another?). (the new simconnect facilities feature doesn't give access to runway lat/lon too, for bad luck). My application must work for every airport, and using external tools like SDE is no solution, too. As I said: the only way is to use the .bgl files that ship with fsx.So, my C# application will have to read the APX*.bgl file to scan for that runway information. Exactly that is the problem: The .bgl looks like cryptic to me and I have no clue, how to make it in any way readable with C#. I can imagine, that there would be some way to decrypt the .bgl to somewhat more readable. Is here anyone, who could point me to the right direction?Thanx very much,Sincerely,Chris.

Share this post


Link to post
Share on other sites

>I can imagine, that there would be some way to decrypt the>.bgl to somewhat more readable. >>Is here anyone, who could point me to the right direction?There are quite a lot of programming data and utilities around which will help. Just a quick Google gets me this linkhttp://www.jordomedia.com/RSS/l_op=viewrss/lid=12479.htmlwhich seems to be a collection of excellent pointers.RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites
Guest Testili

Thank you guys,so far, I know both sites already. The point is: there are tools offered, which I cant use for my purposes. Of course I can read a .bgl with SDE or something. But I need to hardcode the reading of runway lat lon into my program. So these tools dont help me.The bgl PDF i know too. It might be helpful, but Im too newbie to understand, how it could help me with my coding problem.So, my problem remains: I need to access the runway information, which settles inside the .bgl, via c#. I dont know, how to decrypt the bgl, to find the information.Can you help on?Sincerely,Chris.

Share this post


Link to post
Share on other sites

>so far, I know both sites already. The point is: there are>tools offered, which I cant use for my purposes. Of course I>can read a .bgl with SDE or something. But I need to hardcode>the reading of runway lat lon into my program. So these tools>dont help me.Check further. Some of the tools come with source code which have data format declarations. Some even give you the references to semi-professional documentation of the BGLs themselves. I know this because I have followed these routes myself.>The bgl PDF i know too. It might be helpful, but Im too newbie>to understand, how it could help me with my coding problem.I'm not sure what "BGL PDF" you refer to, but if it is the definition of the BGL formats then you won't get any better help. If you know the format of the BGLs and you know how to find them all (follow all the "enabled" layers in the SCENERY.CFG file) what else could you possibly need to know to get to work?>So, my problem remains: I need to access the runway>information, which settles inside the .bgl, via c#. I dont>know, how to decrypt the bgl, to find the information.Have you not found anything in any of those links? Are you sure? I really don't think you are looking hard enough. Try also http://www.scenery.org/design_utilities_d.htm. Winifried Orthmann's BGL analyse package includes a good document. I based my MakeRunways utility on that. The differences to FSx aren't great either.RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites

>So, my problem remains: I need to access the runway>information, which settles inside the .bgl, via c#. I dont>know, how to decrypt the bgl, to find the information.I've just checked. In one link here you could get Mr. Orthmann's detailed format of FSX BGLs, and in the links I provided you could certainly also get his earlier FS2004 data. They are not that far apart in fact.Both detail the precise format of the BGL files, within which is the data you require. So when you say "I dont know, how to decrypt the bgl, to find the information", you do not actually need to decypt anything, as Mr. Orthmann has so kindly done it for you already!I can vouch for his work as i have used it successfully.I can assure you you won't get anything better. Short of someone writing your code for you, that is it!If you want a ready-made data base in easy-to-read format, you are free to use my MakeRunways utility. The current version (4.10) is available on my Support Forum over on SimMarket (see either of the Downloads announcements), and the ZIP now includes information on the CSV file formats.RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites
Guest Testili

Thank you, Pete, for your effort. It would be easier for you to say "let this newbie go, he's too stupid" ^^ I appreciate your help very much.I understand your point, indeed I spent more than a day reading about BGL.My problem is so far more basic: It is a coding problem more likely than a "BGL-understanding-one". I see i.ex. Offset adresses and so on in this PDF you mentioned. I also manage to open the bgl in a hex editor and find some of the things mentioned in the PDF. So far, when it comes to the programmatic view, how do I read in the BGL file with .NET, how do I decode it? I see, that many programs use the the ChilkatDotNet dll for decoding i.ex ... I wonder, is the BGL stuff encoded in a binary format or something else, ...So, I would look for a hint, how to decode the stuff I read from a bgl i.ex. with a streamreader-function, in some format where I can look for the offsets and stuff mentioned in the PDF.Well .... perhaps this is too basic to ask here. It would be enough, if you say, that if I read out the bgl into a hex-format, that I then could get the informations like runway lat lon. Issit like that? Should I decode the bgl to a hex-format?Sincerely,Chris.

Share this post


Link to post
Share on other sites

You say:>I also manage to open the bgl in a hex editor and>find some of the things mentioned in the PDF.and then later:>I wonder, is the BGL stuff encoded in a>binary format or something else, ...but surely your first discovery answers your second? Yes. binary. Mr. Orthmann's guides clearly lay out the bits and bytes and how to find them within the binary file.>how do I read in the BGL file>with .NETI am sure that the facility to open and read files in binary format is present in every possible language you may find in .NET or in any other compiler package for that matter. It is the same as reading any other type of file except you open the file as a binary file, not text, and read it in either in chunks (or your chosen size) instead of 'lines', or better, get its size, allocate enough memory for the whole file, and load it all at once. > how do I decode it? Using Mr. Orthmann's documentation. That is exactly what it is for. Do it by hand first using your hex editor. When you see how to find data by hand, program it that way.>I see, that many programs use the the ChilkatDotNet dll for>decoding i.ex ... Never heard of that. Sorry.>Well .... perhaps this is too basic to ask here. It would be>enough, if you say, that if I read out the bgl into a>hex-formatYou don't want to convert a binary file to hex ("hex" is a character-based representation using 0-9 and A-F characters). You just read the file as a plain binary file. No conversion at all. Read it all to a character or, better, BYTE array of sufficient size. (BYTE is merely unsigned char).Then offset 0 in the file is byte[0] in that array, offset 356 is byte [356], etc. A 32-bit integer at offset 64 is at bytes[64] to [67] inclusive. But you should be defining structures to match Mr. Orthmann's data formats and mapping those to the binary data array appropriately. (Note that those <> parentheses were meant to be square brackets but this web program seems to convert them).All this is really a bit advanced as a training program for a new programmer. You've actually got to scan thousands of BGLs to find the ones you want in the first place in any case.If your object is simply to find information about specific airports I would recommend you look at my MakeRunways program. It is free for use as you wish.Pete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites
Guest Testili

Thanx alot.I think I get the clue of it now due to your tips. Have a nice day,sincerely,Chris.

Share this post


Link to post
Share on other sites

>Check further. Some of the tools come with source code which>have data format declarations. Some even give you the>references to semi-professional documentation of the BGLs>themselves.Just being curious, is there any other and/or better than Winfried Orthmann's documentation available anywhere? The only thing that had helped me in the past (was it FS8 or FS9... can't quite remember) was the source code of Traffic Tools by Lee Swordy (ttoolssource30.zip IIRC) which contained a tool to read all airports, including some very helpful and complete data definitions within the code. For FSX though all I currently have is that PDF mentioned above. That alone being more than helpful, of course. Just curious if there is something else out there.Thanks,Etienne

Share this post


Link to post
Share on other sites

>For FSX though all I>currently have is that PDF mentioned above. That alone being>more than helpful, of course. Just curious if there is>something else out there.I doubt there's much else for FSX yet, but the airport data formats are not all that different to those for FS9, and I think some folks have posted source of BGL analysers for FS9. You'll need to search. Didn't one of those links in this thread take you close to something suitable?Personally I always find trying to decode someone else's code more confusing that writing my own from scratch. Pete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites
Guest Testili

I didn't find something else, too.I wonder, where the author found all these informations for the pdf. Must be a smart head ^^Pete, I agree partially, so far, without a point to start it's #### difficult. But you guys gave me that point, I guess. Still fighting with the bits and bytes, but well, I will succeed :( Tx ~Sincerely, Chris.

Share this post


Link to post
Share on other sites

>I didn't find something else, too.You will have to learn to use search engines like Google. I found this in about 5 minutes of following links and narrowing down searches:http://www.fs2000.org/last/news.asp?id=8022The BGLXML zip includes the program and the sources, for FS2004 of course.>I wonder, where the author found all these informations for>the pdf. Must be a smart head ^^It takes a lot of hacking. It's a process similar to debugging, which you will also have to learn to be a programmer! ;-)RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites
Guest Jacky Brouze

Hi Chris,I confirm that the FSX_File_Structure.PDF written by Winfried Orthmann (follow the above link given by Etienne) is the best documentation I have found about BGL.I wrote a set of procedures to extract airport data in a Delphi program, It works well.Good luckA+Jacky :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...