- testing 3.13.0+dfsg-1
- unstable 3.13.1+dfsg-1
- experimental 3.13.1~rc1+dfsg-1~exp1
| GDAL-RASTER-PANSHARPEN(1) | GDAL | GDAL-RASTER-PANSHARPEN(1) |
NAME¶
gdal-raster-pansharpen - Perform a pansharpen operation
Added in version 3.12.
SYNOPSIS¶
Usage: gdal raster pansharpen [OPTIONS] <INPUT> <SPECTRAL>... <OUTPUT> Perform a pansharpen operation. Positional arguments:
-i, --panchromatic, --input <INPUT> Input panchromatic raster dataset [required] [not available in pipelines]
--spectral <SPECTRAL> Input spectral band dataset [1.. values] [required]
-o, --output <OUTPUT> Output raster dataset [required] [not available in pipelines] Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
-q, --quiet Quiet mode (no progress bar or warning message) [not available in pipelines] Options:
-f, --of, --format, --output-format <OUTPUT-FORMAT> Output format ("GDALG" allowed) [not available in pipelines]
--co, --creation-option <KEY>=<VALUE> Creation option [may be repeated] [not available in pipelines]
--overwrite Whether overwriting existing output dataset is allowed [not available in pipelines]
Mutually exclusive with --append
--append Append as a subdataset to existing output [not available in pipelines]
Mutually exclusive with --overwrite
-r, --resampling <RESAMPLING> Resampling algorithm. RESAMPLING=nearest|bilinear|cubic|cubicspline|lanczos|average (default: cubic)
--weights <WEIGHTS> Weight for each input spectral band [may be repeated]
--nodata <NODATA> Override nodata value of input bands
--bit-depth <BIT-DEPTH> Override bit depth of input bands
--spatial-extent-adjustment <SPATIAL-EXTENT-ADJUSTMENT> Select behavior when bands have not the same extent. SPATIAL-EXTENT-ADJUSTMENT=union|intersection|none|none-without-warning (default: union)
-j, --num-threads <NUM-THREADS> Number of jobs (or ALL_CPUS) (default: ALL_CPUS) Advanced Options:
--if, --input-format <INPUT-FORMAT> Input formats [may be repeated] [not available in pipelines]
--oo, --open-option <KEY>=<VALUE> Open options [may be repeated] [not available in pipelines]
DESCRIPTION¶
gdal raster pansharpen performs a pan-sharpening operation. It can create a "classic" output dataset (such as GeoTIFF), or a VRT dataset describing the pan-sharpening operation.
It takes as input a one-band panchromatic dataset and several spectral bands, generally at a lower resolution than the panchromatic band. The output is a multi-band dataset (with as many bands as input panchromatic bands), enhanced at the resolution of the panchromatic band.
All bands should be in the same coordinate reference system.
More details can be found in the Pansharpened VRT section.
GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET)¶
This program supports serializing the command line as a JSON file using the GDALG output format. The resulting file can then be opened as a raster dataset using the GDALG: GDAL Streamed Algorithm driver, and apply the specified pipeline in a on-the-fly / streamed way.
PROGRAM-SPECIFIC OPTIONS¶
- --bit-depth <val>
- Specify the bit depth of the panchromatic and spectral bands (e.g. 12). If not specified, the NBITS metadata item from the panchromatic band will be used if it exists.
- -i, --panchromatic, --input <INPUT>
- Dataset with panchromatic band. [required]
- -j, --num-threads <value>
- Specify number of threads to use to do the resampling and pan-sharpening itself. Can be an integer number or ALL_CPUS (the default)
- --nodata <val>
- Specify nodata value for bands. Used for the resampling and pan-sharpening computation itself. If not set, deduced from the input bands, provided they have a consistent setting.
- -r, --resampling nearest|bilinear|cubic|cubicspline|lanczos|average
- Select a resampling algorithm. cubic is the default.
- --spatial-extent-adjustment union|intersection|none|none-without-warning
- Select behavior when bands have not the same extent. See SpatialExtentAdjustment documentation in Pansharpened VRT union is the default.
- --spectral <spectral_dataset>[,band=<num>]
- Dataset with one or several spectral bands. [required]
If the band option is not specified, all bands of the dataset are taken into account. Otherwise, only the specified (num)th band. The same dataset can be repeated several times.
- --weights <WEIGHTS>
- Specify a weight for the computation of the pseudo panchromatic value. There must be as many values as input spectral bands.
STANDARD OPTIONS¶
- --append
- Append input raster as a new subdataset to an existing output file. Only works with drivers that support adding subdatasets such as GTiff -- GeoTIFF File Format and GPKG -- GeoPackage raster This also creates the output dataset if it does not exist yet.
- --co, --creation-option <NAME>=<VALUE>
- Many formats have one or more optional creation options that can be used
to control particulars about the file created. For instance, the GeoTIFF
driver supports creation options to control compression, and whether the
file should be tiled.
May be repeated.
The creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Raster drivers format specific documentation for legal creation options for each format.
- --if, --input-format <format>
- Format/driver name to be attempted to open the input file(s). It is
generally not necessary to specify it, but it can be used to skip
automatic driver detection, when it fails to select the appropriate
driver. This option can be repeated several times to specify several
candidate drivers. Note that it does not force those drivers to open the
dataset. In particular, some drivers have requirements on file extensions.
May be repeated.
- --oo, --open-option <NAME>=<VALUE>
- Dataset open option (format specific).
May be repeated.
- -f, --of, --format, --output-format <OUTPUT-FORMAT>
- Which output raster format to use. Allowed values may be given by gdal --formats | grep raster | grep rw | sort
- --overwrite
- Allow program to overwrite existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists.
RETURN STATUS CODE¶
The program returns status code 0 in case of success, and non-zero in case of error (non-blocking errors emitted as warnings are considered as a successful execution).
EXAMPLES¶
Example 1: With spectral bands in a single dataset¶
gdal raster pansharpen panchro.tif rgb.tif pansharpened_out.tif
Example 2: With a few spectral bands from a single dataset, reordered¶
gdal raster pansharpen panchro.tif bgr.tif,band=3 bgr.tif,band=2 bgr.tif,band=1 pansharpened_out.tif
Example 3: With spectral bands in several datasets¶
gdal raster pansharpen panchro.tif red.tif green.tif blue.tif pansharpened_out.tif
Example 4: Specifying weights¶
gdal raster pansharpen -w 0.7,0.2,0.1 panchro.tif multispectral.tif pansharpened_out.tif
Example 5: Select RGB bands from a RGBNir multispectral dataset while computing the pseudo panchromatic intensity on the 4 RGBNir bands¶
gdal raster pipeline read panchro.tif ! pansharpen rgbnir.tif ! select 1,2,3 ! write pansharpened_out.tif
AUTHOR¶
Even Rouault <even.rouault@spatialys.com>
COPYRIGHT¶
1998-2026
| June 1, 2026 |