# `gdal raster update`

Added in version 3.12.

Update the destination raster with the content of the input one.

## Synopsis

    Usage: gdal raster update [OPTIONS] <INPUT> <OUTPUT>

    Update the destination raster with the content of the input one.

    Positional arguments:
      -i, --input <INPUT>                        Input raster dataset [required]
      -o, --output <OUTPUT>                      Output raster dataset [required]

    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)

    Options:
      --geometry <GEOMETRY>                      Clipping geometry (WKT or GeoJSON)
      --geometry-crs <GEOMETRY-CRS>              CRS of clipping geometry
      -r, --resampling <RESAMPLING>              Resampling method. RESAMPLING=nearest|bilinear|cubic|cubicspline|lanczos|average|rms|mode|min|max|med|q1|q3|sum (default: nearest)
      --no-update-overviews                      Do not update existing overviews

    Advanced Options:
      --oo, --open-option <KEY>=<VALUE>          Open options [may be repeated]
      --if, --input-format <INPUT-FORMAT>        Input formats [may be repeated]
      --wo, --warp-option <NAME>=<VALUE>         Warping option(s) [may be repeated]
      --to, --transform-option <NAME>=<VALUE>    Transform option(s) [may be repeated]
      --et, --error-threshold <ERROR-THRESHOLD>  Error threshold

## Description

gdal raster update can be used to update an existing target raster dataset with the pixel values of the source raster, doing reprojection if the source and target datasets do not have the same coordinate reference systems. The extent, size, resolution or coordinate reference system of the target dataset are not modified by this operation.

Overviews are updated by this command (using gdal raster overview refresh), unless `--no-update-overviews` is specified.

### Standard options

-r, --resampling <RESAMPLING>

  Resampling method to use. Available methods are:

  `nearest`: nearest neighbour resampling (default, fastest algorithm, worst interpolation quality).

  `bilinear`: bilinear resampling.

  `cubic`: cubic resampling.

  `cubicspline`: cubic spline resampling.

  `lanczos`: Lanczos windowed sinc resampling.

  `average`: average resampling, computes the weighted average of all non-NODATA contributing pixels.

  `rms` root mean square / quadratic mean of all non-NODATA contributing pixels

  `mode`: mode resampling, selects the value which appears most often of all the sampled points. In the case of ties, the first value identified as the mode will be selected.

  `max`: maximum resampling, selects the maximum value from all non-NODATA contributing pixels.

  `min`: minimum resampling, selects the minimum value from all non-NODATA contributing pixels.

  `med`: median resampling, selects the median value of all non-NODATA contributing pixels.

  `q1`: first quartile resampling, selects the first quartile value of all non-NODATA contributing pixels.

  `q3`: third quartile resampling, selects the third quartile value of all non-NODATA contributing pixels.

  `sum`: compute the weighted sum of all non-NODATA contributing pixels

  Note

  When downsampling is performed (use of `--resolution` or `--size`), existing overviews (either internal/implicit or external ones) on the source image will be used by default by selecting the closest overview to the desired output resolution. The resampling method used to create those overviews is generally not the one you specify through the `-r` option.

--geometry <WKT_or_GeoJSON>

  Geometry as a WKT or GeoJSON string of a polygon (or multipolygon) to which to restrict the update. If the input geometry is GeoJSON, its CRS is assumed to be WGS84, unless there is a CRS defined in the GeoJSON geometry or `--geometry-crs` is specified. If the input geometry is WKT, its CRS is assumed to be the one of the input dataset, unless `--geometry-crs` is specified. The X and Y axis are the "GIS friendly ones", that is X is longitude or easting, and Y is latitude or northing.

--geometry-crs <CRS>

  CRS in which the coordinate values of `--geometry` are expressed. If not specified, it is assumed to be the CRS of the input dataset. The geometry will be reprojected from the geometry-crs to the CRS of the dataset being updated.

--no-update-overviews

  Do not update existing overviews.

### Advanced options

--wo, --warp-option <NAME>=<VALUE>

  Set a warp option. The `GDALWarpOptions::papszWarpOptions` docs show all options. Multiple options may be listed.

--to <NAME>=<VALUE>

  Set a transformer option suitable to pass to `GDALCreateGenImgProjTransformer2()`. See `GDALCreateRPCTransformerV2()` for RPC specific options.

--et, --error-threshold <ERROR-THRESHOLD>

  Error threshold for transformation approximation, expressed as a number of source pixels. Defaults to 0.125 pixels unless the `RPC_DEM` transformer option is specified, in which case an exact transformer, i.e. `--error-threshold=0`, will be used.

## Examples

### Example 1: Update existing out.tif with content of in.tif using cubic interpolation

    $ gdal raster update -r cubic in.tif out.tif