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.

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"