The airport elevation tool elev generates MSFS height map rectangles from elevation imagery and writes them into a XML file that can be directly compiled into BGL.

If airport XML airport is defined with -airport, then elevations of airport elements will also be updated, runway deformation profiles will be generated, and existing height map rectangles with the same priority level will be replaced with the newly generated ones. If it is not defined, then a standalone XML file will be created, which can be used with -mesh component initialized with the project tool.

Export region can be defined through a bounding box (-bounds) or by providing a vector file containing polygons (-border). Holes can be cut for airports using exclusion polygons (-exclude).

Imagery is loaded in alphabetical order, one source at a time, layered from bottom up. Multiple sources may be defined with wildcard-supported filemasks. Last-defined source will be added on top of previously loaded imagery.

All imagery must be in the same projection, but may differ in resolution.

The way MSFS implements height maps suggests that they are intended for smaller areas, such as for adding a hill or fixing a slope. While the same approach also works for very large areas, this may not be future-proof.
Elevation values must be in meters. If your source is in feet, use -scale 0.3048 to convert values from feet to meters.


msfs elev [-help] [-formats] -imagery filemask [filemask ...]
          (-bounds lon_min lon_max lat_min lat_max | -border file)
          [-epsg code] [-res m] [-falloff m] [-priority val] [-resample algo]
          [-fillnodata [m]] [-scale val] [-offset val]
          [-airport xml] [-nodefo] [-exclude file] [-dump shp]

Shows a list of all currently supported file formats.

-imagery <filemask> [<filemask> …]
A list of one or more elevation imagery files to use (wildcard supported). Recommended format is GeoTIFF.

-bounds <lon_min lon_max lat_min lat_max>
Area to be covered by height maps in WGS84 decimal degrees. Alternatively, the area may be defined with -border.

-border <file>
Vector file containing polygons that define the export area. All rectangles overlapping with these polygons will be written to output file. Recommended vector file formats are ESRI Shapefile or Google Earth KML. Choose this or use -bounds.

-epsg <code>
Projection of input imagery expressed in EPSG code (eg 4326 for WGS84). Overrides auto-detected projection.

-res <m>
Target resolution in meters per pixel.

-falloff <m>
Falloff distance in meters to ensure smooth transition to stock terrain (default: 100 m). See Falloff Distance.

-priority <val>
Height map priority level (default: 0). When generating height maps into an airport XML file (-airport), all existing height maps with the same priority will be removed.

-resample <algo>
Resampling algorithm to use when reprojecting the imagery (default: bilinear). See GDAL for a list of all supported algorithms.

-fillnodata [m]
Fill areas with no data by interpolating nearby pixels, or with a specific value, if provided. See Partial Data section below.

-scale <val>
Multiplies elevation values by the specified value. Use to convert data in feet to meters.

-offset <val>
Shifts elevation values by the specified amount. Use to correct data that does not have sea level at 0.

-airport <xml>
XML file containing airport information. If provided, height maps will be added to the specified file, existing airport elements will be moved to imagery elevations and runway deformation profiles will be generated for each runway (can be skipped with -nodefo).

Skips writing runway deformation profiles, when using -airport. Existing data will remain unmodified.

-exclude <file>
Vector file containing polygons. Areas under these polygons will remain untouched. See Excluded Areas section below.

-dump <shp>
Dumps bounds of generated heightmap rectangles into a Shapefile for debugging.

Output XML file.


Load imagery from “C:\DEM” folder and generate 10 m resolution height maps for area covered by “C:\area.kml” into “C:\MyAirport\EGLC.xml”:

msfs elev "C:\DEM\*.tif" -border "C:\area.kml" -airport "C:\MyAirport\EGLC.xml" -res 10 "C:\MyAirport\EGLC.xml" 

See Sloped runway tutorial for an extended example.


Partial Data

To effectively work with elev tool, you should understand how it works internally.

It takes arbitrary shapes as input and generates a grid of height maps to cover them. Then imagery is loaded and partially or fully uncovered tiles will be filtered out, because MSFS height maps do not support partial data (nodata). This means that your imagery should always be large enough to cover the resulting grid. You can analyze generated grids with -dump option, which writes the grid to a shapefile.

Input shapes (1) Loads polygons (-border) or constructs from coordinates (-bounds).
Bounding box (2) Calculates bounding box.
Calculated grid (3) Fills bounding box with rectangles, filtering out uncovered regions.
Loaded imagery (4) Loads imagery.
Partial result (5a) Filters out partial rectangles and saves the remaining to a file.
Filled result (5b) Fills partial rectangles (-fillnodata 0) and saves all of them to a file.

Notice how the polygon is slightly larger than imagery in the example above (4). This results in outermost tiles getting filtered out (5a), because they do not fully contain elevation data. Since it is a group of islands surrounded by water, you can use -fillnodata 0 to fill missing areas with 0 m water level to fully cover partial tiles (5b) and get the whole area exported.

Any other void filling should be done in appropriate GIS programs.

Excluded Areas

When developing a regional terrain that covers multiple airports (without including them), you may want to cut out holes around airports to avoid conflicts with third party airport packages.

You can use -exclude option to assign a vector file with polygons that define excluded areas. These areas will retain their original elevation and remain free from any influence.

Input shapes (1) Input border polygon (yellow) and exclusion polygon (red) are loaded.
Bounding box (2) A grid is created to cover the border, but not excluded areas. It is trimmed to fit the polygons.
Calculated grid (3) The final grid of height maps is saved to output file.

Falloff Distance

Falloff distance (-falloff) controls how far beyond its border the influence of a height map rectangle extends.

The default value is 100 meters. In mountainous regions, 100 m falloff may cause sharp spikes and cliffs running along the edge of your height map grid. An increase to 300-500 meters greatly reduces them.

In other areas, large falloff distances may cause ripples along grid edges. Lowering the falloff distance to 100 m removes them.

Input shapes (1) Trench running across a mountain range with 100 m falloff.
Bounding box (2) Ripples with 1000 m falloff. Note the solid yellow edge of a height map and dashed yellow edge of the falloff area.