• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

BGLDEC - A resample BGL DECompressor


Staff member
Resource contributor
Orbx also changed the lclookup.bgl. Their worldlc.bgl throws an error with tmfviewer, so they have changed the format for that one bgl. But I believe FSX landclass files still work.
Got it. Queue the "not-so-senior moment", I conflated worldlc and lclookup in my last post, yikes!

I will investigate the worldlc.bgl differences in FSW, hopefully they are minimal (such as additional landclass or different QMID, not a format change). Curious as to whether folks would appreciate lclookup.bgl support.

Sorry for the self-induced confusion.


Staff member
Resource contributor
I would like a decompilation of the lclookup for FSX and FSW. It would be nice to see what is going on under that hood.

Also, I found a mesh bgl set that doesn't decompile completely. It is the FreeMeshX freeware mesh. Their bounds are not QMID bounds, but rather 'even' latitude and longitude, surrounded by missing data. BGLDEC will only decompile some of the lower QMID levels. A program error is then thrown. The output is some BIN files, and some -MASK.bin
Thanks Dick. I tested with some files from FreeMeshX and was able to reproduce the crash. The files are very large (>40000 records in the DB), but the latest version should be able to handle files of this size.

I noted two things:
1. These sceneries appear to be using FractionBits, which is not yet supported but is planned for the next version.
2. The crash seems to be from a bad operator new[] during the writing of the blendmask. It is possible that these files are doing something different here, or it could just be a mem leak.

Will debug and post a patch once I get it sorted out.


Staff member
Resource contributor
Hi Sean.

Attached is a zip file using a bgl derived from SRTM data. It includes a batchfile that decompiles with the -stitch and one without. The one with -stitch crashes, the one without stitching decompiles completely.


Thanks Dick. I found and have fixed the bug. Let me get FractionBits support in the output so it will render the FreeMeshX files correctly, then I will post a new version.
@See Michel - could you PM me with a Dropbox/Onedrive(or equivalent) link to the BGL that is giving you trouble, so I can debug on my end? I have no known issues at the moment, would like to patch it up if I can find the issue.
Hi, I think I identified the problem. The extracted part is the same as I can see in the sim. The not shown part is displayed in tfmviewer, when you select “show missing...”. Any chance that bgldec can extract that part also?
Hi everyone, a quick update on bgldec development.

I am working towards a 1.0 release. Currently I have a few bug fixes queued up, recolored BMP output just like tmfviewer for all types, and just added experimental support for FractionBits/Scaled Elevation Values (see attached screenshots for a FreeMeshX bgl that previously could not be read).

Before I release, I will be implementing the following changes:
1. Will write new .inf files that match the output data as they are resampled to the QMID grid
2. Blit water mask as separate file, like blend mask
3. A tidier cli interface, with more filtering options

I should have these updates soon, and after some extensive testing, will release 1.0.


Congratulations! really exciting and interesting topic. :stirthepo
I'm just starting to learn some binaryreading working on bgl files and I'm very impressed with your work on the pictures decompression algorithms, wow! The true is that the 3/4th of the fsdevelopper's wiki about bgl format is still Chinese for me ;) but it's a pleasure to learn with you... guys who juggling between binary, hexa and decimal as easy as getting on a bike. By myself, reading the algorithms of the wiki, I only begin to try to understand the notion of "shifting" with the acronym << in c # ... I see that I still have lot of work but that's fine :confused:

If I can contribute a lot:
- about the Geotiff format: it is very simple to create a georeferenced Tif by simply adding a .tfw to a classical tif file. The .tfw structure is only a "txt" file that contains the following data:

- X pixel dimension: Width in the unit of pixel X
- Rotate on lines: 0 for good images
- Rotate on columns: 0 for good images
- Y pixel dimension: Often negative value (Inverse of X pixel dimension, see below)
- X-coordinate of the point of origin (in principle upper left-hand point of the image)
- Y-coordinate of the point of origin (in principle upper left-hand point of the image)

Exemple (of course you can use latitude and longitude decimal degree as unity):

And From QMID (level, U, V) we can found coordinates (latitude, longitude) of the upper left corner with:

Latitude = 90 - (V x 180/2exp(level-1))
Longitude = (U x 240/2exp(level-1)) - 180

keep up the great job theisomizer :)

ps: +1 for Arno's ask about a .Net library or other api to work with TRQ1 data
Last edited:
I'm using BGLDec 0.9.2 and am trying to get the population density exported, but unfortunately, the program dies after exporting 3 files

This is the output I'm getting:

bgldec PopulationDensity.bgl BIN
BGLDEC v0.9.2 - A BGL DECompressor for resampled BGL data

BGL FileName: PopulationDensity.bgl
Mode: BIN
Output Directory: Local

* Input File Read
* BGL Header Read, 2 Sections
* Decompilation Started
* Decompiling Section 0, 6144 subsections
* Decompiling Section 1, 6 subsections
* Decompilation Finished
* Terrain Database Loaded From Quadtree; Dumping Files
* Debug: Data found in DB for: POP-7-63-16
* Debug: Data found in DB for: POP-7-0-2

Any ideas?
Hi @epojar,

Thanks for posting that, it has been too long since I have updated this. I have fixed many bugs since the last public release. I was working towards a 1.0 release with several new features, however have been quite busy with other projects.

I have backported the changes, please try the attached version and let me know if that fixes your specific issue. This version has several in-progress features and should be considered experimental.



Hi Sean,

The icing on the cake would be if you could output a resample .inf file for BMP-STITCH as you do for BIN-STITCH.

I need to clone the .bmp file to remove unwanted features.
Hey George,

It is very much still in the plans. I hacked the bin-stitch inf together during a flight months ago, I will clean it up and get it all working for bmp once I get through the release of another project I am working on. Home stretch!
New version 0.9.4 is up, with better inf writing, more bugs fixed, and MS Flight support. Unfortunately other projects have take priority recently, but I am still marching towards a 1.0 release with the completion of the last few items on the roadmap.

Flight is almost the same format, TRQ2 mostly just adds support for a detail lookup map, save for a few a bytes I couldn't decode (paging @stonelance, please come back, I have some serious questions for you).