BGLDEC - A resample BGL DECompressor

rhumbaflappy

Moderator
Staff member
Resource contributor
#81
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.
 
#82
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.
 

rhumbaflappy

Moderator
Staff member
Resource contributor
#83
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
 
#84
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.
 

rhumbaflappy

Moderator
Staff member
Resource contributor
#85
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.
 

Attachments

#86
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.
 
#88
@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?
 
#91
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.
 

Attachments

#93
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):
Code:
50.00000000000000
0.00000000000000
0.00000000000000
-50.00000000000000
157999.9547888
339000.1459853

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:
#94
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?
 
#95
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.

Cheers!
 

Attachments

#97
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.
 
#98
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!
 
Top