GeoTIFF Formats – Adding Custom Text Entries to GeoTIFF Header

cloud-optimized-geotifffile formatsgeotiff-tiff

After processing a GeoTIFF, I want to include a note in the output GeoTIFF's header1. A keyword-value note like: "comment = image processed with software version x.y.z". Like we do with FITS files (https://docs.astropy.org/en/stable/io/fits/usage/headers.html#comment-history-and-blank-keywords) in astronomy.

Is that possible with GeoTIFF? If not, which GIS-compatible file format would allow me to do so?

  1. A file's header: metadata information about the file's content (i.e, data) encapsulated in the file itself (typically at the beggining of the file).

Best Answer

TIFF has tags for that purpose and you can edit them for example with gdal_edit https://gdal.org/programs/gdal_edit.html

-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.

Example:

gdal_edit metadata.tif -mo "comment=image processed with software version x.y.z"

Check the result with gdalinfo

gdalinfo metadata.tif
...
Metadata:
  AREA_OR_POINT=Area
  comment=image processed with software version x.y.z
...