APPLY_CONVOLUTION
The APPLY_CONVOLUTION command allows you to create a new layer from an existing raster or grid layer by applying a convolution filter (resampling method) to the layer.
The following parameters are supported by the command:
- FILENAME - filename or layer description of the layer(s) to use as input to the operation. You can use * to use all loaded raster imagery layers. This is the default. This parameter can be listed more than once to specify multiple input files, like FILENAME="FILENAME_1" FILENAME="FILENAME_2". When running the script in the context of the main map view (including loading a workspace) you can also pass in the value 'USER CREATED FEATURES' to have the 'User Created Features' layer updated or 'SELECTED LAYERS' to have any layers selected in the Control Center.
- LAYER_DESC - specifies the name to assign to the output layer. If no layer description is provided, a default name will be assigned.
- SAMPLING_METHOD - specifies the name of the sampling method / filter to apply. See the IMPORT command for a list of supported SAMPLING_METHOD names. You can either specify a SAMPLING_METHOD value or provide a custom filter matrix with the CUSTOM_FILTER parameter.
- CUSTOM_FILTER - provides either the name of an existing custom filter (added from the UI), or the raw matrix of weight values in row-major order. For example, to provide a 3x3 matrix of weights with the center slightly elevated, you might use CUSTOM_FILTER=”1 1 1 1 2 1 1 1 1”.
- NORMALIZE_WEIGHTS - specifies whether or not the weights in a CUSTOM_FILTER should be normalized to sum to 1 (if not zero). This is enabled by default, so use NORMALIZE_WEIGHTS=FALSE to disable normalization.
-
Specify Bounding Box for Operation
See also Specify Bounds for Operation
- GLOBAL_BOUNDS - specifies the combine bounds in units of the current global projection. There should be 4 values in a comma-delimited list following the parameter name. The values should be in order of minimum x, minimum y, maximum x, maximum y.
- GLOBAL_BOUNDS_SIZE - specifies the combine bounds in units of the current global projection. There should be 4 values in a comma-delimited list following the parameter name. The values should be in order of minimum x, minimum y, width in x, width in y.
- LAT_LON_BOUNDS - specifies the combine bounds in latitude/longitude degrees. There should be 4 values in a comma-delimited list following the parameter name. The values should be in order of west-most longitude, southern-most latitude, eastern-most longitude, northern-most latitude.
- LAYER_BOUNDS - specifies that the operation should use the bounds of the loaded layer(s) with the given filename. For example, to export to the bounds of the file "c:\test.tif", you would use LAYER_BOUNDS="c:\test.tif". Keep in mind that the file must be currently loaded.
- LAYER_BOUNDS_EXPAND - specifies that the operation should expand the used LAYER_BOUNDS bounding box by some amount. The amount to expand the bounding rectangle by should be specified in the current global projection. For example, if you have a UTM/meters projection active and want to expand the bounds retrieved from the LAYER_BOUNDS parameter by 100 meters on the left and right, and 50 meters on the top and bottom, you could use LAYER_BOUNDS_EXPAND="100.0,50.0". You can also specify a single value to apply to all 4 sides, or supply 4 separate values in the order left,top,right,bottom.
- SNAP_BOUNDS_TO_MULTIPLE - specifies that the top-left corner of the bounding box for the operation should be snapped to a multiple of the given value. For example, using SNAP_BOUNDS_TO_MULTIPLE=1 will snap the top-left corner to the nearest whole number. The values will always go smaller for X/easting/longitude and larger to Y/northing/latitude so you always get at least what is requested.
- SNAP_BOUNDS_TO_SPACING - specifies that the top-left corner of the bounding box for the operation should be snapped to a multiple of the resolution of the operation. For example, if you are exporting at 5 meter spacing, the top left corner will be snapped to the nearest multiple of 5. Use SNAP_BOUNDS_TO_SPACING=YES to enable or SNAP_BOUNDS_TO_SPACING=NO to disable. If not provided, the global setting for snapping exports to the nearest sample spacing boundary from the Advanced section of the General tab of the Configuration dialog will be used.
- USE_EXACT_BOUNDS - specifies that the exact bounds that were defined in the command should be used. Generally, when the bounds specified in a command are not the same as the data bounds, the command uses the intersection between the two. When USE_EXACT_BOUNDS=YES is specified, the command will use the bounds as specified, instead of the intersection.
SAMPLE
Here are example script commands showing how to apply a convolution filter to all currently loaded raster layers.
GLOBAL_MAPPER_SCRIPT VERSION=1.00 APPLY_CONVOLUTION FILENAME="*" SAMPLING_METHOD="SHARPEN_3X3"
GLOBAL_MAPPER_SCRIPT VERSION=1.00 APPLY_CONVOLUTION FILENAME="*" CUSTOM_FILTER="1 2 1 2 4 2 1 2 1"