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 newgdalcommand line interface: seegdal 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.xmlfiles 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 orNone, 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 toNone, the real statistics are calculated from the file and the ones set toNoneare 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 to1. π (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-unscaleduring agdal_translaterun. 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 to0. 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-unsetmdis also specified. (so-unsetmdis 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,-trand-unsetgtoptions are exclusive. pick one, she's monogamous. - the
-unsetstatsand either-statsor-approx_statsoptions 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>
π COPYRIGHT π
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
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms