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] dest
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.
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.
Projection of input imagery expressed in EPSG code (eg 4326 for WGS84). Overrides auto-detected projection.
Target resolution in meters per pixel.
Falloff distance in meters to ensure smooth transition to stock terrain (default: 100 m). See Falloff Distance.
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.
Resampling algorithm to use when reprojecting the imagery (default: bilinear). See GDAL for a list of all supported algorithms.
Fill areas with no data by interpolating nearby pixels, or with a specific value, if provided. See Partial Data section below.
Multiplies elevation values by the specified value. Use to convert data in feet to meters.
Shifts elevation values by the specified amount. Use to correct data that does not have sea level at 0.
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.
Vector file containing polygons. Areas under these polygons will remain untouched. See Excluded Areas section below.
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.
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.
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.
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.
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.