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 dataset [required]
-o, --output Output raster dataset (created by algorithm) [required]
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config = Configuration option [may be repeated]
--progress Display progress bar
Options:
-f, --of, --format, --output-format Output format
--co, --creation-option = Creation option [may be repeated]
--overwrite Whether overwriting existing output is allowed
-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]
DESCRIPTION
gdal raster fill-nodata fills nodata areas by interpolating from valid
pixels around the edges of the area.
The following options are available:
-f, --of, --format, --output-format
Which output raster format to use. Allowed values may be given
by gdal --formats | grep raster | grep + | sort
--output-layer
Output layer name.
--overwrite
Allow program to overwrite existing target file or dataset.
Otherwise, by default, gdal errors out if the target file or
dataset already exists.
-b
Select an input to be processed. Bands are numbered from
1. Default is the first band of the input dataset.
-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.
--mask
Use the first band of the specified file as a validity mask
(zero is invalid, non-zero is valid).
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-2025
May 6, 2025 GDAL-RASTER-FILL-NODATA(1)