GDAL-RASTER-FILL-NODATA(1) GDAL GDAL-RASTER-FILL-NODATA(1)
NAME
gdal-raster-fill-nodata - Fill nodata values in a raster dataset
Added in version 3.11.
SYNOPSIS
Usage: gdal raster fill-nodata [OPTIONS]
Fill nodata raster regions by interpolation from edges.
Positional arguments:
-i, --input Input raster datasets [required] [not available in pipelines]
-o, --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 = 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 ("GDALG" allowed) [not available in pipelines]
--co, --creation-option = 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
-b, --band Input band (1-based index) (default: 1)
-d, --max-distance The maximum distance (in pixels) that the algorithm will search out for values to interpolate. (default: 100)
-s, --smoothing-iterations The number of 3x3 average filter smoothing iterations to run after the interpolation to dampen artifacts. The default is zero smoothing iterations. (default: 0)
--mask Use the first band of the specified file as a validity mask (zero is invalid, non-zero is valid).
--strategy By default, pixels are interpolated using an inverse distance weighting (invdist). It is also possible to choose a nearest neighbour (nearest) strategy.. STRATEGY=invdist|nearest (default: invdist)
Advanced Options:
--if, --input-format Input formats [may be repeated] [not available in pipelines]
--oo, --open-option = Open options [may be repeated] [not available in pipelines]
DESCRIPTION
gdal raster fill-nodata fills nodata areas by interpolating from valid
pixels around the edges of the area.
This subcommand is also available as a potential step of gdal raster
pipeline (since GDAL 3.12)
Added in version 3.12.
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.
NOTE:
However this algorithm is not natively streaming compatible.
Consequently a temporary dataset will be generated, which may cause
significant processing time at opening.
PROGRAM-SPECIFIC OPTIONS
-b, --band
Select an input to be processed. Bands are numbered from
1. Default is the first band of the input dataset.
--mask
Use the first band of the specified file as a validity mask
(zero is invalid, non-zero is valid).
--max-distance
Specifies the maximum distance (in pixels) that the algorithm
will search out for values to interpolate. Default is 100
pixels.
--smoothing-iterations
Specifies the number of smoothing iterations to apply to the
filled raster. This can help to reduce artifacts in the filled
areas. Default is 0 iterations.
--strategy
Select the interpolation to use. By default, pixels
are interpolated using an inverse distance weighting (invdist).
It is also possible to choose a nearest neighbour (nearest)
strategy.
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 =
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/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 =
Dataset open option (format specific).
May be repeated.
-f, --of, --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: Fill nodata areas in a raster
The command specifies to use the second band of the input raster, 50 px
max distance, 3 smoothing iterations and the nearest strategy for
interpolation. The output will be saved in output.tif.
gdal raster fill-nodata -b 2 --max-distance 50 --smoothing-iterations 3 \
--strategy nearest --mask mask.tif \
input.tif output.tif
AUTHOR
Alessandro Pasotti
COPYRIGHT
1998-2026
August 18, 2026 GDAL-RASTER-FILL-NODATA(1)