GDAL-RASTER-COMPARE(1)

πŸ“¦
version 3.13.3 Β· 4 versions
, in alpine 3.24, arch rolling, ubuntu stonking

✨ gdal-raster-compare β€” bestie edition ✨

okay so this is gdal-raster-compare from the GDAL manual (section 1, periodt), and it's here to help you compare two raster dataset πŸ’…

Added in version 3.12. πŸŽ€

🌈 SYNOPSIS 🌈

Usage: gdal raster compare [OPTIONS] <REFERENCE> <INPUT>

Compare two raster datasets.


Positional arguments:
  --reference <REFERENCE>              Reference dataset [required]
  -i, --input <INPUT>                  Input raster dataset [required] [not available in pipelines]

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 or warning message) [not available in pipelines]

Options:
  --skip-all-optional                  Skip all optional comparisons
  --skip-binary                        Skip binary file comparison
  --skip-crs                           Skip CRS comparison
  --skip-geotransform                  Skip geotransform comparison
  --skip-overview                      Skip overview comparison
  --skip-metadata                      Skip metadata comparison
  --skip-rpc                           Skip RPC metadata comparison
  --skip-geolocation                   Skip Geolocation metadata comparison
  --skip-subdataset                    Skip subdataset comparison

Advanced Options:
  --if, --input-format <INPUT-FORMAT>  Input formats [may be repeated] [not available in pipelines]
  --oo, --open-option <KEY>=<VALUE>    Open options [may be repeated] [not available in pipelines]

πŸ’– DESCRIPTION πŸ’–

gdal raster compare is literally the friend who sits down, looks at two GDAL-supported datasets, and tells you exactly what's different between them. 🫢 And not just a vibe β€” it reports the differences to standard output, and it hands you back the difference count in its exit value. iykyk.

So here's the social contract, bestie: the first dataset β€” the one you pass as the first positional argument or through --reference β€” is the reference slash exact slash golden dataset. The second dataset β€” first as second positional argument, or through --input β€” is the one being compared to the reference. That's the hierarchy, and we respect it. ✨

What actually gets checked? Image pixels, and a whole bunch of metadata. 🧚 There's also a byte by byte comparison happening, and if that one fails it counts as one difference. So listen: if the only thing you care about is that the GDAL visible data is identical, then a difference count of 1 (that's the binary difference, girly) should be considered acceptable. Or you can just pass --skip-binary and skip the byte to byte comparison entirely. your call, main character πŸ‘‘

Also iconic: this program can be used as the last step of a raster pipeline. 🌸

The following options are available:


πŸ‘‘ PROGRAM-SPECIFIC OPTIONS πŸ‘‘

  • --input <input-dataset> β€” the dataset being compared to the reference dataset. We call it the input dataset. πŸ’œ
  • --reference <reference-dataset> β€” the dataset that is considered correct. We call it the reference dataset. πŸ‘‘
  • --skip-all-optional β€” whether to skip all optional tests. This is an alias to defining all the other --skip-XXXX options. So like, one flag and you've skipped the whole optional syllabus. πŸ’…

The remaining non-optional tests are:

  • checking dataset width, height and band count
  • checking band description, data type, color interpretation and nodata value
  • checking pixel content
  • --skip-binary β€” whether to skip exact comparison of binary content.
  • --skip-crs β€” whether to skip comparison of coordinate reference systems (CRS).
  • --skip-geolocation β€” whether to skip comparison of GEOLOCATION metadata domain.
  • --skip-geotransform β€” whether to skip comparison of geotransform matrix.
  • --skip-metadata β€” whether to skip comparison of metadata
  • --skip-overview β€” whether to skip comparison of overviews.
  • --skip-rpc β€” whether to skip comparison of Rational Polynomial Coefficients (RPC) metadata domain.
  • --skip-subdataset β€” whether to ignore comparison of all subdatasets that are part of the dataset.

⭐ STANDARD OPTIONS ⭐

  • --if, --input-format <format> β€” the format/driver name to be attempted to open the input file(s). ngl it's generally not necessary to specify it, but you can use it to skip automatic driver detection when it fails to select the appropriate driver. This option can be repeated several times to specify several candidate drivers. ⚠️ Note that it does not force those drivers to open the dataset β€” in particular, some drivers have requirements on file extensions.

May be repeated.

  • --oo, --open-option <NAME>=<VALUE> β€” dataset open option (format specific). πŸ“

May be repeated.


πŸ”₯ RETURN STATUS CODE πŸ”₯

The program returns status code 0 in case of success, and non-zero in case of error. (Non-blocking errors emitted as warnings are considered as a successful execution, so like, don't panic, bestie. 🫢)


πŸ¦‹ EXAMPLES πŸ¦‹

Example 1: Comparing two datasets that differ by their data types

$ gdal raster compare autotest/gcore/data/byte.tif autotest/gcore/data/uint16.tif
Reference file has size 736 bytes, whereas input file has size 1136 bytes.
Reference band 1 has data type Byte, but input band has data type UInt16

$ echo $?
2

Example 2: Comparing two datasets while values have different units

$ gdal raster pipeline read test_in_foot.tif ! calc --calc "X * 0.3048" ! compare --reference=reference_in_meter.tif

πŸ’œ AUTHOR πŸ’œ

Even Rouault <even.rouault@spatialys.com> β€” the icon, the legend, the moment. πŸ‘‘


1998-2026


and that's the whole page, no cap. πŸ’– this was GDAL-RASTER-COMPARE(1) from the GDAL manual, dated Aug 18, 2026 β€” go forth and compare those rasters, you absolute queen πŸŒˆβœ¨πŸ’…

πŸ“¦ where this page comes from