The PAN_SHARPEN command fuses a lower resolution color/multi-band image with a higher resolution panchromatic (grayscale) image to create a new color/multi-band image at the same detail as the pan image. This is often used with satellite-based imagery with a pan sensor at double the resolution as the color/multi-spectral sensor. The result is a new color/multi-band layer. In addition, all of the option parameters for the IMPORT command are also supported for this command.
The following parameters are used by the PAN_SHARPEN command:
- COLOR_LAYER - full path and filename of the color/multi-band layer to pan sharpen. You can also pass in the full description of the loaded layer to use in case you want to use a layer not loaded from a file.
- PAN_LAYER - full path and filename of the panchromatic layer to use. You can also pass in the full description of the loaded layer to use in case you want to use a layer not loaded from a file.
- LAYER_DESC - description to use for the new layer. If not provided, the description will be that of the color layer with (Pan Sharpened) appended.
- ALGORITHM - specifies which pan sharpening algorithm will be used to perform the operation. The following values are supported:
- IHS - converts the color to the HSI (hue/saturation/intensity) colorspace, then replaces the intensity with the pan value. This is the default value.
- BROVEY - uses the Brovey algorithm
- ESRI - uses the Ersi pan sharpening transformation
- MEAN - uses a simple mean (average) of the pan value and each band for the new band value
- WEIGHTS - provides a list of weight values to apply to each band in the color image. This should be a comma-delimited list of 3 (RGB) or 4 (RGBI) weights to apply. The weight order is red, green, blue, infrared. If not provided, each band will be equally weighted when calculating an initial intensity for the IHS and BROVEY algorithms. The ESRI algorithm uses a default weighting of "0.167,0.167,0.167,0.5" (i.e. half to infrared and equally divided amongst the rest). The weight values will automatically be normalized so they sum up to 1 for all used bands, so if you want to weight green at twice the other bands, you could use WEIGHTS="1,2,1,1".
- SPATIAL_RES - specifies spatial resolution. Defaults to the minimum spatial resolution of the two layers if not specified. Should be formatted as x_resolution,y_resolution. The units are the units of the current global projection. For example, if UTM was the current global projection and you wanted to export at 30 meter spacing, the parameter/ value pair would look like SPATIAL_RES=30.0,30.0. You can also specify as a percentage of the default resolution by adding a percent. For example to get half the detail your double the spatial resolution value, so you would use SPATIAL_RES="200%,200%".
- SPATIAL_RES_METERS - specifies spatial resolution to use in meters. The value in meters will automatically be converted to the curent view/export projection units. For example, to do an export at 2.0 meter spacing (or as close as you can get to that in the current units), use SPATIAL_RES_METERS=2.0, or to do an export at 1.0 meters in X by 1.5 meters in Y, use SPATIAL_RES_METERS="1.0,1.5".
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.
Example: Create a pan sharpened layer from 2 loaded 16-bit images:
// Define variables with filename for color and pan layers DEFINE_VAR NAME="COLOR_FNAME" VALUE="LC80330322015307LGN00_B4325_RGBI" DEFINE_VAR NAME="PAN_FNAME" VALUE="LC80330322015307LGN00_B8_PAN.TIF" // Load color and pan layers IMPORT FILENAME="%COLOR_FNAME%" TRANSPARENT_COLOR="RGB(255,255,255)" \ AUTO_CONTRAST="YES" CONTRAST_SHARED="NO" CONTRAST_STRETCH_SIZE="2.000" CONTRAST_MODE="PERCENTAGE" IMPORT FILENAME="%PAN_FNAME%" LOAD_FLAGS="0~0~0~1~0~0" TRANSPARENT_COLOR="RGB(0,0,0)" \ AUTO_CONTRAST="YES" CONTRAST_SHARED="NO" CONTRAST_STRETCH_SIZE="0.000" CONTRAST_MODE="PERCENTAGE" // Pan Sharpen images PAN_SHARPEN COLOR_LAYER="%COLOR_FNAME%" PAN_LAYER="%PAN_FNAME%" ALGORITHM="BROVEY"