GDAL_EDIT(1)

GDAL_EDIT(1) πŸ’– bestie's guide to editing your dataset in place

okay so real talk: this is the manual page for gdal_edit, and it lives in the GDAL manual. it's a Python utility, so it's only showing up at the party if your GDAL Python bindings are installed. no bindings, no gdal_edit, that's the vibe check. ✨


🌸 NAME 🌸

gdal_edit β€” edit in place various information of an existing GDAL dataset. that's it, that's the whole thing, it goes into your existing file and messes with its projection, geotransform, nodata, metadata, all that. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

gdal_edit [--help] [--help-general] [-ro] [-a_srs <srs_def>]
        [-a_ullr <ulx> <uly> <lrx> <lry>] [-a_ulurll <ulx> <uly> <urx> <ury> <llx> <lly>]
        [-tr <xres> <yres>] [-unsetgt] [-unsetrpc] [-a_nodata <value>] [-unsetnodata]
        [-a_coord_epoch <epoch>] [-unsetepoch]
        [-unsetstats] [-stats] [-approx_stats]
        [-setstats <min> <max> <mean> <stddev>]
        [-scale <value>] [-offset <value>] [-units <value>]
        [-colorinterp_<X> {red|green|blue|alpha|gray|undefined|pan|coastal|rededge|nir|swir|mwir|lwir|...}]...
        [-gcp <pixel> <line> <easting> <northing> [<elevation>]]...
        [-unsetmd] [-oo <NAME>=<VALUE>]... [-mo <META-TAG>=<VALUE>]...
        <datasetname>

πŸ’œ DESCRIPTION πŸ’œ

so bestie, gdal_edit is your girl for editing in place all kinds of info on a dataset you already have β€” projection, geotransform, nodata, metadata. like, the file stays the file, it just gets ✨corrected✨.

she only works with raster formats that support update access to existing datasets. if your format can't be updated, this is not the icon for you, sorry. πŸŽ€

CAUTION: ngl this one's important. depending on the format, older values of the updated information might still be found in the file in a "ghost" state, even if they're no longer accessible through the GDAL API. the example given: the GTiff -- GeoTIFF File Format format. and btw that is not an exhaustive list β€” so don't come for me if your format is also haunted πŸ‘». (this is not a exhaustive list, quoting the original, we keep it real here.)
NOTE: gdal_edit is a Python utility, and is only available if GDAL Python bindings are available. yes bestie, it's that kind of girl.
TIP: equivalent in new gdal command line interface: see gdal raster edit.

✨ OPTIONS ✨

  • --help β€” show this help message and exit. classic. πŸ‘‘
  • --help-general β€” gives a brief usage message for the generic GDAL commandline options and exit. it's the general fam, not this tool specifically.
  • -ro β€” open the dataset in read-only. might be useful for drivers that are refusing to use the dataset in update-mode (rude of them honestly). in that case, the updated information will go into PAM .aux.xml files instead. 🫢
  • -a_srs <srs_def> β€” defines the target coordinate system. this coordinate system will be written to the dataset. if you pass the empty string or None, then the existing coordinate system gets removed (for TIFF/GeoTIFF, might not be well supported besides that β€” so like, good luck with that part). 😭
  • -a_coord_epoch <epoch> β€” assign/override the coordinate epoch of the dataset, as a decimal year (e.g., 2021.3). ✨
added in version 3.9.
  • -unsetepoch β€” remove the coordinate epoch of the dataset. bye bestie πŸ’…
added in version 3.9.
  • -a_ullr <ulx> <uly> <lrx> <lry> β€” assign/override the georeferenced bounds of the dataset. four numbers, one rectangle, slay. 🌸
  • -a_ulurll <ulx> <uly> <urx> <ury> <llx> <lly> β€” assign/override the georeferenced bounds of the dataset from three points: upper-left, upper-right and lower-left. unlike -a_ullr, this one also supports rotated datasets (edges not parallel to coordinate system axes). she's flexible, we love that. πŸ¦‹
added in version 3.1.
  • -tr <xres> <yres> β€” set target resolution. the values must be expressed in georeferenced units. and listen: both must be positive values. no negative nonsense. ⭐
  • -unsetgt β€” remove the georeference information. gone, deleted, not your problem anymore.
  • -unsetrpc β€” remove RPC information. also gone. πŸ’€
  • -unsetstats β€” remove band statistics information.
  • -stats β€” calculate and store band statistics. crunch time, bestie.
  • -setstats <min> <max> <mean> <stddev> β€” store user-defined values for band statistics (minimum, maximum, mean and standard deviation). and here's the cute part: if any of the values is set to None, the real statistics are calculated from the file and the ones set to None are used from the real statistics. so you can mix and match, main character energy. πŸ‘‘
  • -approx_stats β€” calculate and store approximate band statistics. it's giving "close enough".
  • -a_nodata <value> β€” assign a specified nodata value to output bands.
  • -unsetnodata β€” remove existing nodata values. bye πŸ‘‹
  • -scale <value> β€” assign a specified scale value to output bands. if a single scale value is provided it will be set for all bands. alternatively, one scale value per band can be provided, in which case the number of scale values must match the number of bands. if no scale is needed, it it recommended to set the value to 1. 😭 (yes, "it it", I kept it, we don't fix the original's typos, we respect the source.)

scale and offset are generally used together. for example, scale and offset might be used to store elevations in a unsigned 16bit integer file with a precision of 0.1, and starting from -100. true values would be calculated as:

true_value = (pixel_value * scale) + offset
NOTE: these values can be applied using -unscale during a gdal_translate run. noted, bestie. πŸŽ€
  • -offset <value> β€” assign a specified offset value to output bands. if a single offset value is provided it will be set for all bands. alternatively, one offset value per band can be provided, in which case the number of offset values must match the number of bands. if no offset is needed, it recommended to set the value to 0. for more see scale. (again, "it recommended" β€” original said it, I said it, no cap.) πŸ’…
  • -units <value> β€” assign a unit to output band(s). so specific. so chic. πŸ’–
added in version 3.1.
  • -colorinterp_<X> β€” change the color interpretation of band X (where X is a valid band number, starting at 1). the values you can hand her: {red|green|blue|alpha|gray|undefined|pan|coastal|rededge|nir|swir|mwir|lwir|...}. go off, color theory queen 🌈
  • -gcp pixel <line> <easting> <northing> [<elevation>] β€” add the indicated ground control point to the dataset. this option may be provided multiple times to provide a set of GCPs. stack 'em up. πŸ“
  • -unsetmd β€” remove existing metadata (in the default metadata domain). can be combined with -mo. 🧚
  • -mo <META-TAG>=<VALUE> β€” passes a metadata key and value to set on the output dataset if possible. this metadata is added to the existing metadata items, unless -unsetmd is also specified. (so -unsetmd is the "actually, clear the board first" option.)
  • -oo <NAME>=<VALUE> β€” open option (format specific). iykyk. πŸ“

the exclusive-relationship drama πŸ’”

bestie, some of these options do NOT get along, and honestly? valid of them.

  • the -a_ullr, -a_ulurll, -tr and -unsetgt options are exclusive. pick one, she's monogamous.
  • the -unsetstats and either -stats or -approx_stats options are exclusive. you can't delete the stats and compute the stats at the same time, that's a whole contradiction.

🌟 RETURN STATUS CODE 🌟

the program returns status code 0 in case of success, and non-zero in case of error. and here's the little detail that matters: non-blocking errors emitted as warnings are considered as a successful execution. so if it's just being dramatic quietly, it still counts as a win. 😌


πŸŽ€ EXAMPLE πŸŽ€

Example 1: Override the spatial bounds of a dataset and assign metadata values

gdal_edit -mo DATUM=WGS84 -mo PROJ=GEODETIC -a_ullr 7 47 8 46 test.ecw

two metadata tags and a whole new set of bounds in one line, we love an efficient queen. ✨

Example 2: Assign scale and offset values to dataset

gdal_edit -scale 1e3 1e4 -offset 0 10 twoBand.tif

the values in the GeoTIFF are not changed. read that again bestie, the pixel values themselves stay exactly as they were, we're only touching the scale/offset info. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Even Rouault <even.rouault@spatialys.com>


1998-2026


okay that's the whole page!! 🫢 this was the GDAL_EDIT(1) page from the GDAL manual, dated Aug 18, 2026, and the source/version at the bottom is GDAL. go edit something in place, bestie, you got this. periodt. πŸ’…πŸŒˆβ­

πŸ“¦ where this page comes from