ExportRasterEx¶
- globalmapper.ExportRasterEx(str aFilename, GM_RasterExportFormat_t32 aFormat, [GM_LayerHandle_t32] aLayerList, GM_Rectangle_t aWorldBounds, sint32 aPixelWidth, sint32 aPixelHeight, GM_RasterExportFlags_t32 aFlags, str aExtraFlags) GM_Error_t32 [source]¶
Exports one or more layers to a new raster file. If None is passed for the layer handle list, all loaded layers will be saved to the new raster file, otherwise only the specified layer(s) will be exported. If None is provided for the world bounds, all available data will be exported, otherwise only data within the specified bounds will be exported.
The new raster file create will be in the current view projection as returned by the GetProjection function. You can change the view projection, and thus the export projection, by calling the SetProjection function.
The aExtraFlags parameter allows the specification of any extra options not supported in the aFlags parameter. The options should be specified with the option name, followed by an equal sign, followed by the option value. Most users will pass None for this value unless they need a non-default value for an extra option. Currently the following extra options are supported:
QUALITY (JPG or GeoTIFF formats only) - specifies the export quality value. Values should range from 1 to 100. The default is 75. Higher values result in a higher quality, but larger result. For example, to set the quality to 90, use “QUALITY=90” as your extra flags value. For GeoTIFF exports this is only used for an export using JPG-in-TIFF compression.
COMPRESSION (ECW and JPG2000 formats only) - specifies the target compression ratio for the export. Values should range from 1 (lossless) to 100. The default is 10. Higher values result in a smaller files but lower quality. For example, to set the target compression ratio to 1:20, use “COMPRESSION=20” as your extra flags value.
DPI (BMP, GeoTIFF, and JPG formats only) - specifies the DPI value to store in the file. The default value of 0 means that no DPI value will be stored in the file.
PALETTE (GeoTIFF format only) - specifies the name of a palette file to use for the export. If any part of the path has spaces use %20 for the space.
TILE_SIZE (GeoTIFF format only) - specifies that the exported GeoTIFF file should use tile rather than strip orientation and specifies the size of the tile. For example, to create 512x512 tiles internal to the GeoTIFF file, use TILE_SIZE=512.
VECTOR_DRAW_FLAGS - use to specify the GM_DrawFlags_t32 to use for rendering vector data for export. Any flags in aFlags that pertain to vector draw flags will override this value. You can specify a hex or decimal number for the value.
HEADER (GeoTIFF format only) - specifies whether or not the generated GeoTIFF file should have a GeoTIFF header written. This is enabled by default, add HEADER=NO to disable saving a header.
OPTIMIZE_CODING (JPG format only) - specifies whether or not entropy encoding should be optimized for JPEG compression. This is for advanced users only. Use OPTIMIZE_CODING=1 to enable optimizing entropy encoding.
WRITE_JFIF_HEADER (JPG format only) - specifies whether or not a JFIF header should be written to the exported JPEG file. This is for advanced users only. Use WRITE_JFIF_HEADER=1 to enable writing a JFIF header.
DCT_METHOD (JPG format only) - specifies the DCT method to use for JPEG compression. This is for advanced users only. Valid values are 0 for JDCT_ISLOW, 1 for JDCT_IFAST, and 2 for JDCT_FLOAT.
VALID_ALPHA (PNG format only) - specifies the alpha value (between 1 and 255) to use for valid pixels. By default any valid pixels will be completely opaque (i.e. alpha = 255).
RES_MULT - (ADVANCED USERS) specifies a multiplier to apply to the export resolution when choosing which layer of an online source to pull from. For example, adding RES_MULT=2 will cause an export at 5m per pixel to choose an online zoom level more appropriate for a 10m per pixel export. Values smaller than 1 cause a more detailed layer to be pulled from.
The CADRG/CIB export format has a set of required value that describe the export. In addition the filename provided should be for the a.toc (table of contents) file for the data set. The frame files will be saved in folders underneath that. The following flag values are used:
MAP_NAME - The map name, usually a 6-character name
SERIES - The chart series 2-letter code from [Section 5.1.4, MIL-STD-2411-1]. The following list includes some commonly supported values (note that any 2-letter code is supported): * GN - 1:5M Scale GNC (Global Navigation Chart) * JN - 1:2M Scale JNC (Jet Navigation Chart) * TP - 1:500K Scale TPC (Tactical Pilotage Chart) * I1 - 10m Resolution CIB Imagery * I2 - 5m Resolution CIB Imagery * I3 - 2m Resolution CIB Imagery * I4 - 1m Resolution CIB Imagery * I5 - 0.5m Resolution CIB Imagery
SCALE - The scale to export at. In most cases the SERIES implies the scale so this value is ignored, but it you use a SERIES with a variable scale this is required.
PRODUCER_CODE - The numeric producer code ID from [MIL-STD-2411-1, Section 5.2.1), like 1 for AFACC (Air Force Air Combat Command).
SECURITY_CLASS - The 1-character security classification from [MIL-STD-2411-1, Section 5.1.8). The default is SECURITY_CLASS=U for unclassified.
SECURITY_COUNTRY - The 2-character security country code from [MIL-STD-2411-1, Section 5.1.7). The default is SECURITY_COUNTRY=US for the US.
SECURITY_MARKING - The 2-character security marking from [MIL-STD-2411-1, Section 5.1.9). The default is SECURITY_MARKING=uu for unclassified.
VERSION - The file version. The default is 1 if you don’t provide a value.
For example, to export a 1:500k scale TPC CADRG from the DMAAC you could pass the following extra flags string:
"MAP_NAME=ABC123 SERIES=TP PRODUCER_CODE=3 SECURITY_CLASS=U SECURITY_COUNTRY=US SECURITY_MARKING=uu VERSION=1"
- Parameters:
aFilename (str) – Name of new file to create
aFormat (GM_RasterExportFormat_t32) – Format to export
aLayerList ([GM_LayerHandle_t32]) – List of layers to export or None for all
aWorldBounds (GM_Rectangle_t) – World bounds to export or None for all
aPixelWidth (sint32) – Width in pixels of new image
aPixelHeight (sint32) – Height in pixels of new image
aFlags (GM_RasterExportFlags_t32) – Export flags
aExtraFlags (str) – Additional text-based flags for some formats (use None for defaults)
- Returns:
Error Code
- Return type:
GM_Error_t32