The imagery extraction tool imgx extracts parts of aerial imagery for manual editing.

Parts to extract may be defined by either a bounding box (-bounds) or by supplying a vector file containing polygons with areas to extract (-areas). Extracted parts are saved as PNG files.

After editing, extracted and edited parts can be layered on top of unedited imagery in aerial tool to apply changes to output tiles.

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


msfs imgex [-help] [-formats]
           -imagery filemask [filemask ...]
           (-bounds lon_min lon_max lat_min lat_max | -areas file)
           [-prefix name]
           [-threads num] [-epsg code] [-resample algo]
Shows a list of all currently supported file formats.
-imagery <filemask> [<filemask> …]
A list of one or more aerial imagery files to use (wildcard supported). Recommended format is GeoTIFF.
-bounds <lon_min lon_max lat_min lat_max>
Export area bounding box in WGS84 decimal degrees. The defined area will be extracted from input imagery and saved as a PNG file. Alternatively, export areas may be defined with -areas.
-area <file>
Vector file containing polygons that define areas to export. Every area will be exported to a separate PNG file. Recommended vector file formats are ESRI Shapefile or Google Earth KML. Choose this or use -bounds.
-prefix <name>
Naming prefix to use when saving PNG files. Defaults to extract when using with -bounds, and to [name] when using with -areas. Name enclosed in square brackets means that the value is read from a field of that name instead of taking it literally. For example, [description] will take name for the file from description field of the vector file.
-threads <num>
How many CPU threads to use for processing (default: all).
-epsg <code>
Projection of input imagery expressed in EPSG code (eg 4326 for WGS84). Overrides auto-detected projection.
-resample <algo>
Resampling algorithm to use when extracting the imagery (default: lanczos). See GDAL for a list of all supported algorithms. This has effect only when input imagery consists of multiple files in different resolutions.
Output folder for PNG files.


Bounding box

Take GeoTIFF files from “Imagery” folder, extract a region defined by bounding box coordinates, and save it to “Extracts” folder prefixed with “airfield”:

msfs imgex -imagery "Imagery\*.tif" -bounds 25.49077 25.49380 58.34381 58.34535 -prefix "airfield" "Extracts"

After the process completes, “Extracts” folder will contain “airfield.png”.

Once you finish editing “airfield.png”, you can layer it on top of original GeoTIFF files in aerial tool by setting it the last imagery file:

msfs aerial -imagery "Imagery\*.tif" "Extracts\airfield.png" -border "border.kml" -res 1 "PackageSources\Aerial\Tiles"

Since imagery files are loaded on top of each other, the last-mentioned file (“airfield.png” in this case) ends on top of others.

Polygons from a file

Same as above, but extracts images using polygons from a Google Earth file as reference:

msfs imgex -imagery "Imagery\*.tif" -areas "myairport.kmz" "Extracts"

Assuming the Google Earth file contains two polygons, named “airfield” and “village”, this process will create “airfield.png” and “village.png”.

If you are using an ESRI Shapefile and you want to take file names from a custom field such as “LOCATION”, type:

msfs imgex -imagery "Imagery\*.tif" -areas "patch_areas.shp" -prefix "[LOCATION]" "Extracts"

Adding a literal prefix with -prefix yields sequentially named PNG files:

msfs imgex -imagery "Imagery\*.tif" -areas "patch_areas.shp" -prefix "patch" "Extracts"

This results in “patch_1.png”, “patch_2.png”, and so forth.