GDAL-RASTER-EDIT(1) GDAL GDAL-RASTER-EDIT(1)

gdal-raster-edit - Edit in place a raster dataset

Added in version 3.11.

Usage: gdal raster edit [OPTIONS] <DATASET>
Edit a raster dataset.
Positional arguments:
  --dataset <DATASET>               Dataset (to be updated in-place, unless --auxiliary) [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:
  --auxiliary                       Ask for an auxiliary .aux.xml file to be edited
  --crs <CRS>                       Override CRS (without reprojection)
  --bbox <BBOX>                     Bounding box as xmin,ymin,xmax,ymax
  --nodata <NODATA>                 Assign a specified nodata value to output bands ('none', numeric value, 'nan', 'inf', '-inf')
  --metadata <KEY>=<VALUE>          Add/update dataset metadata item [may be repeated]
  --unset-metadata <KEY>            Remove dataset metadata item(s) [may be repeated]
  --unset-metadata-domain <DOMAIN>  Remove dataset metadata domain(s) [may be repeated]
  --gcp <GCP>                       Add ground control point, formatted as pixel,line,easting,northing[,elevation], or @filename [may be repeated]
  --stats                           Compute statistics, using all pixels
                                    Mutually exclusive with --approx-stats
  --approx-stats                    Compute statistics, using a subset of pixels
                                    Mutually exclusive with --stats
  --hist                            Compute histogram

gdal raster edit can be used to edit a raster dataset.

This subcommand is also available as a potential step of gdal raster pipeline

Dataset name, to be updated in-place, unless --auxiliary is set. Required.
Force opening the dataset in read-only mode. For drivers that implement the Persistent Auxiliary Metadata (PAM) mechanism, changes will be saved in an auxiliary side car file of extension .aux.xml.
Override CRS, without reprojecting.

The coordinate reference systems that can be passed are anything supported by the OGRSpatialReference::SetFromUserInput() call, which includes EPSG Projected, Geographic or Compound CRS (i.e. EPSG:4296), a well known text (WKT) CRS definition, PROJ.4 declarations, or the name of a .prj file containing a WKT CRS definition.

null or none can be specified to unset an existing CRS.

Note that the spatial extent is also left unchanged.

Override the spatial bounding box, in CRS units, without reprojecting or subsetting. 'x' is longitude values for geographic CRS and easting for projected CRS. 'y' is latitude values for geographic CRS and northing for projected CRS.
Override nodata value.

null or none can be specified to unset an existing nodata value.

Add/update metadata item, at the dataset level. May be repeated.
Remove metadata item, at the dataset level. May be repeated.
Added in version 3.12.

Remove metadata domain, at the dataset level. May be repeated.

Compute raster band statistics for all bands.
Added in version 3.12.

Set ground control point(s), replacing any existing GCPs. Each GCP must be formatted as a string "pixel,line,easting,northing" or "pixel,line,easting,northing,elevation". Each GCP must be specified with a --gcp argument.

It is also possible to provide a single --gcp argument whose value is the filename of a vector dataset, prefixed with @. This dataset must have a single layer with the following required fields column, line, x, y, and optionally id, info and z.

Compute raster band statistics for all bands. They may be computed based on overviews or a subset of all tiles. Useful if you are in a hurry and don't need precise stats.

NOTE:

This option is not available when the command is part of a pipeline.
Compute histogram information for all bands.

NOTE:

This option is not available when the command is part of a pipeline.

$ gdal raster edit --crs=EPSG:32632 my.tif

$ gdal raster edit --bbox=2,49,3,50 my.tif

$ gdal raster edit --metadata AUTHOR=EvenR my.tif

$ gdal raster edit --unset-metadata AUTHOR my.tif

$ gdal raster edit --gcp 0,0,2,49 --gcp 50,100,3,48 my.tif

$ gdal raster edit --gcp @gcps.csv my.tif

Even Rouault <even.rouault@spatialys.com>

1998-2025

November 7, 2025