BGLXML - a freeware multi-platform decompiler for FSX BGL files

(C) 2004-2007, Alessandro G. Antonini - (Central Park Informatica)


What is BGLXML?

BGLXML is an utility which analyzes and decompiles BGL files into FSX format and produces human readable XML files to be recompiled with Microsoft BGLCOMP. It fully supports almost if not all options included into new BGL file format (Microsoft has introduced significant changements since previous FS releases). If a BGL file contains objects created with Microsoft MakeMDL (which is the utility to convert three-dimensional objects created with GMax), BGLXML is able to extract them and write back to hard disk in .MDL format (for each XML file produced by BGLXML there will be nnn MDL files in the same directory than XML). BGLXML is also able to decode all objects into a BGL or only those interesting you (see Partial decode switches below).


BGLXML License

BGLXML is freeware, open-source, and is licensed under GNU GPL - if you are in doubt about what this means, please read the COPYING file which is contained inside the distribution archive.

**** FRIENDLY WARNING ***
GNU General Public License implies that any application and / or program library must be redistributed with source code (or with the chance to get source code for anybody making request of it). Therefore, if you build a program or a library using BGLXML source code, then you also have to release it under GNU GPL (with source code). If this bothers, you don't have to use even a line of BGLXML source code within your programs.


WARRANTY
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
INSTALLATION

Simply create a directory on your hard drive and UNZIP the distribution archive inside it. You have four executable files, which are:

The rest of the distribution archive contains:


USAGE
For those people not very acquainted with command line programs, I have made a Windows Explorer version: open your BGLXML folder and double click on the XMLSHELL.EXE icon. This will allow you to drive the command line version, BGLXML.EXE, through the GUI. Otherwise, BGLXML is a command line executable which works in a character mode window. To use it under Window 9x or NT/XP you have to open a command prompt box, and change to the directory you extracted the distribution archive. Ex: suppose if you have extracted it into c:\bglxml. Open the command prompt box and the issue the command: CHDIR C:\BGLXML. (to have a great aid with command line mode applications I suggest you try 4DOS or 4NT, available from JPSOFT). Then, type BGLXML.EXE if you are under Windows or BGLXMLD.EXE if you are under DOS. BGLXML has several parameters (in fact, it does nothing if it's launched alone) which are:

-t - this means terse mode. If this parameter is omitted then the XML output will contain several information about each decoded object (just experiment to understand what I mean)

-d - print lat/lon info as DD/MM/SS instead of decimal degrees. Most objects have latitude and longitude parameters, for example:

<SceneryObject lat="66 30 00" lon="-23 20 00" ... > - this is a scenery object with latitude and longitude in DD/MM/SS and is a result of a decompilation made with the d switch. If the switch weren't applied then it would be <SceneryObject lat="66.50" lon="-23.33" ... >

-m - print range in nautical miles (default is in meters). Many objects have a range parameter, such as VOR or NDB. a <range="35000" ...> (35000 meters) would be the result of a decompilation  made without the m switch. Otherwise it would be  <range="18.88M" ...>

-f - print altitude in feet (default is in meters). Many objects have an altitude parameter, such as VOR, AIRPORTS and RUNWAYS. a <alt="800" ...> (800 meters) would be the result of a decompilation  made without the f switch. Otherwise it would be  <alt="2624.64F" ...>

-h - type BGLXML.EXE -h to obtain additional help on command line switches.

Switches may be specified separately (e.g -t -m -f) or they may be included all together in a single string ( e.g. -dmf)

The other parameters have not a switch and mean, in order, the input BGL file to decode and the XML output to write. The output file parameter may be omitted, in this case the output file will be created in the same path of input file, with XML extension.

Partial decode switches:

if you don't want to extract all object files from a BGL but instead you want to extract only those interesting you, then you may apply Partial decode function. How it works: first you define a circle having a central latitude, a central longitude and a radius; then, BGLXML measures the distance between each object's latitude and longitude and the central latitude/central longitude of  our circle. If the distance is more than our circle radius, then the object won't be decompiled.

-n - this switch specifies the central latitude of our circle. Argument may be in decimal degrees format or it may also be specified using SCASM notation (dd:mm:ss). If latitude is south, prepend a S before argument (Examples: -n45.6 -nS41.8 -n22:33:58 -nS51:40:56.5)

-e - this switch specifies the central longitude of our circle. Argument may be in decimal degrees format or it may also be specified using SCASM notation (dd:mm:ss). If longitude is west, prepend a W before argument (Examples: -e45.6 -eW41.8 -e22:33:58 -eW51:40:56.5)
-r - this switch specifies the radius (in kilometers) of our circle (example: -r15 - circle has a 15 kms radius).

Several usage samples:

BGLXML.EXE "c:\my bgls\myfile.bgl" - this will produce an output file such as "c:\my bgls\myfile.xml"

BGLXML.EXE "c:\my bgls\myfile.bgl" "c:\my xmls\myfile.xml" - this will produce a file named myfile.xml into c:\my xmls

BGLXML.EXE -t -f -m -d "c:\my bgls\myfile.bgl" "c:\my xmls\myfile.xml" - this will produce a file named myfile.xml into c:\my xmls - a terse output will be written, with lat/lon as DD/MM/SS, altitudes in feet, ranges in NM

BGLXML.EXE "c:\my bgls\myfile.bgl" "c:\my xmls\myfile.xml" -tmfd - same as above (switches may be stuffed before or after file names)

BGLXML.EXE "c:\my bgls\myfile.bgl" "c:\my xmls\myfile.xml" -tmfd -n41.564 -e5.6562 -r10 - only decode those objects which are closer than 10 kilometers to N41.564, E5.6562


SUPPORT and BUG REPORTS

Support (as well as bug reports) may be obtained into My Home Page Forum. - this is the place to get program updates, besides www.avsim.com


KNOW ISSUES AND LIMITATIONS


BGL FILES DEALT BY BGLXML
File Prefix
Contain
AP*.BGL
Airport and terminal NAVAID
AT*.BGL
Routes, way-points, GeoPol's and Boundaries
NV*.BGL
VOR and NDB
OB*.BGL
Buildings and other scenery objects

Besides, there are BGL files named as cities (EX: SANFRAN.BGL,PARIS.BGL, etc.) These files contain three-dimensional Objects and they are also dealt by BGLXML - MDL files are extracted from them (MDL files are those files which are converted from GMax using Microsoft MakeMDL)


CHANGES
For a list of changes, addition and bug fixes, please see HYSTORY.TXT.

HAVE FUN,

Alex - alex_a66@cpinf.com