GDAL-RASTER-INFO(1)

πŸ’– GDAL-RASTER-INFO(1) πŸ’–

okay bestie, welcome to the gdal-raster-info page, living inside the GDAL manual (section 1, the user commands one, we love that for her) πŸ‘‘


✨ NAME ✨

gdal-raster-info β€” get information on a raster dataset πŸ—ΊοΈ

Added in version 3.11.


🌸 SYNOPSIS 🌸

Usage: gdal raster info [OPTIONS] <INPUT>

Return information on a raster dataset.

Positional arguments:
  -i, --dataset, --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]

Options:
  -f, --of, --format, --output-format <OUTPUT-FORMAT>  Output format. OUTPUT-FORMAT=json|text
  --mm, --min-max                                      Compute minimum and maximum value
  --stats                                              Retrieve or compute statistics, using all pixels
                                                       Mutually exclusive with --approx-stats
  --approx-stats                                       Retrieve or compute statistics, using a subset of pixels
                                                       Mutually exclusive with --stats
  --hist                                               Retrieve or compute histogram

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]
  --no-gcp                                             Suppress ground control points list printing
  --no-md                                              Suppress metadata printing
  --no-ct                                              Suppress color table printing
  --no-fl                                              Suppress file list printing
  --checksum                                           Compute pixel checksum
  --list-metadata-domains, --list-mdd                  List all metadata domains available for the dataset
  --mdd, --metadata-domain <METADATA-DOMAIN>           Report metadata for the specified domain. 'all' can be used to report metadata in all domains

Esoteric Options:
  --no-nodata                                          Suppress retrieving nodata value
  --no-mask                                            Suppress mask band information
  --subdataset <SUBDATASET>                            Use subdataset of specified index (starting at 1), instead of the source dataset itself
  --crs-format <CRS-FORMAT>                            Which format to use to report CRS. CRS-FORMAT=AUTO|WKT2|PROJJSON (default: AUTO)

πŸ¦‹ DESCRIPTION πŸ¦‹

so gdal raster info literally just... tells you everything about a GDAL-supported raster dataset. she lists it all out, and when you're in the command line she drops it on the standard output stream, or if you're using the API she puts it in the output parameter. either way, she delivers πŸ’…

here's the full lineup of what gets reported (when it's known, obvs):

  • the format driver used to access the file πŸš—
  • raster size (in pixels and lines)
  • the coordinate system for the file (in short form AUTH_NAME:CODE when possible, or otherwise OGC WKT2:2019)
  • the geotransform associated with the file (rotational coefficients are currently not reported, rip πŸ₯²)
  • corner coordinates in georeferenced, and if possible lat/long based on the full geotransform (but not GCPs)
  • ground control points πŸ“
  • file wide (including subdatasets) metadata
  • band data types
  • band color interpretations 🎨
  • band block size
  • band descriptions
  • band min/max values (internally known and possibly computed)
  • band checksum (if computation asked)
  • band NODATA value
  • band overview resolutions available
  • band unit type (i.e.. "meters" or "feet" for elevation bands)
  • band pseudo-color tables

Starting with GDAL 3.12, gdal raster info can be used as the last step of a pipeline πŸ”₯

the following options are available:


πŸŽ€ PROGRAM-SPECIFIC OPTIONS πŸŽ€

  • --approx-stats β€” read and display image statistics. forces computation if there are no stats already stored in the image. and yeah, they might be computed based on overviews or just a subset of all the tiles. so, lowkey perfect if you're in a hurry and don't need precise stats ⏱️
  • --checksum β€” force computation of the checksum for each band in the dataset.
  • -f, --of, --format, --output-format json|text β€” which output format to use. default is JSON, and starting with GDAL 3.12, text when invoked from the command line. so basically: terminal girlies get text πŸ’–
  • --crs-format AUTO|WKT2|PROJJSON β€” Added in version 3.13.

which format to use to report the CRS. in AUTO default mode, if the CRS can be captured with an authority name and code (known of PROJ), only a summary of the CRS gets reported, including its name, ID, type and area of use. otherwise you get the full WKT2:2019 definition. 🌍

NOTE: --crs-format can only be set when --output-format is set to text. the JSON text format includes both WKT2 and PROJJSON. no cap 🫢
  • --hist β€” report histogram information for all bands πŸ“Š
  • --list-mdd (also --list-metadata-domains) β€” list all metadata domains available for the dataset.
  • --mdd, --metadata-domain <domain>|all β€” adds metadata using:
    • domain β€” report metadata for the specified domain.
    • all β€” report metadata for all domains.
  • --mm, --min-max β€” force computation of the actual min/max values for each band in the dataset.
  • --no-ct β€” suppress printing of color table.
  • --no-fl β€” only display the first file of the file list.
  • --no-gcp β€” suppress ground control points list printing. may be useful for datasets with a huge amount of GCPs, such as L1B AVHRR or HDF4 MODIS which contain thousands of them 😭 (thousands!! bestie!!)
  • --no-mask β€” suppress band mask printing. is implied if --no-nodata is specified.
  • --no-md β€” suppress metadata printing. some datasets may contain a lot of metadata strings. like a lot.
  • --no-nodata β€” suppress nodata printing. implies --no-mask.

can be useful for example when querying a remove GRIB2 dataset that has an index .idx side-car file, together with --no-md

  • --stats β€” read and display image statistics. force computation if no statistics are stored in an image.
  • --subdataset <n> β€” if the input dataset contains several subdatasets, read and display a subdataset with specified n number (starting from 1). this is an alternative of giving the full subdataset name.

⭐ STANDARD OPTIONS ⭐

  • --if, --input-format <format> β€” format/driver name to be attempted to open the input file(s). it is generally not necessary to specify it, but it can be used 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, a lil warning never killed nobody, but an error? she'll let you know 😌


πŸ‘‘ EXAMPLES πŸ‘‘

🌈 Example 1: Getting information on the file utmsmall.tif as text output

$ gdal raster info utmsmall.tif
Driver: GTiff/GeoTIFF
Files: utmsmall.tif
Size is 100, 100
Coordinate Reference System:
  - name: NAD27 / UTM zone 11N
  - ID: EPSG:26711
  - type: Projected
  - projection type: Transverse Mercator
  - units: metre
Data axis to CRS axis mapping: 1,2
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) (117d38'28.21"W, 33d54' 8.47"N)
Lower Left  (  440720.000, 3745320.000) (117d38'26.75"W, 33d50'53.66"N)
Upper Right (  446720.000, 3751320.000) (117d34'34.59"W, 33d54' 9.62"N)
Lower Right (  446720.000, 3745320.000) (117d34'33.28"W, 33d50'54.82"N)
Center      (  443720.000, 3748320.000) (117d36'30.71"W, 33d52'31.66"N)
Band 1 Block=100x81 Type=Byte, ColorInterp=Gray

Example 2: Getting info on utmsmall.tif as JSON output, stats included πŸ’–

Okay so we want the whole picture, as machine-readable JSON, with --stats on top. Watch it go:

$ gdal raster info --format=JSON --stats utmsmall.tif
{
  "description":"utmsmall.tif",
  "driverShortName":"GTiff",
  "driverLongName":"GeoTIFF",
  "files":[
    "utmsmall.tif"
  ],
  "size":[
    100,
    100
  ],
  "coordinateSystem":{
    "wkt":"PROJCRS[\"NAD27 / UTM zone 11N\",\n    BASEGEOGCRS[\"NAD27\",\n        DATUM[\"North American Datum 1927\",\n            ELLIPSOID[\"Clarke 1866\",6378206.4,294.978698213898,\n                LENGTHUNIT[\"metre\",1]]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        ID[\"EPSG\",4267]],\n    CONVERSION[\"Transverse Mercator\",\n        METHOD[\"Transverse Mercator\",\n            ID[\"EPSG\",9807]],\n        PARAMETER[\"Latitude of natural origin\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8801]],\n        PARAMETER[\"Longitude of natural origin\",-117,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8802]],\n        PARAMETER[\"Scale factor at natural origin\",0.9996,\n            SCALEUNIT[\"unity\",1],\n            ID[\"EPSG\",8805]],\n        PARAMETER[\"False easting\",500000,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8806]],\n        PARAMETER[\"False northing\",0,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8807]]],\n    CS[Cartesian,2],\n        AXIS[\"easting\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1]],\n        AXIS[\"northing\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1]],\n    ID[\"EPSG\",26711]]",
    "dataAxisToSRSAxisMapping":[
      1,
      2
    ]
  },
  "geoTransform":[
    440720.0,
    60.0,
    0.0,
    3751320.0,
    0.0,
    -60.0
  ],
  "metadata":{
    "":{
      "AREA_OR_POINT":"Area"
    },
    "IMAGE_STRUCTURE":{
      "INTERLEAVE":"BAND"
    }
  },
  "cornerCoordinates":{
    "upperLeft":[
      440720.0,
      3751320.0
    ],
    "lowerLeft":[
      440720.0,
      3745320.0
    ],
    "lowerRight":[
      446720.0,
      3745320.0
    ],
    "upperRight":[
      446720.0,
      3751320.0
    ],
    "center":[
      443720.0,
      3748320.0
    ]
  },
  "wgs84Extent":{
    "type":"Polygon",
    "coordinates":[
      [
        [
          -117.6420428,
          33.9023684
        ],
        [
          -117.6416377,
          33.848257
        ],
        [
          -117.5767844,
          33.8485775
        ],
        [
          -117.5771485,
          33.9026895
        ],
        [
          -117.6420428,
          33.9023684
        ]
      ]
    ]
  },
  "bands":[
    {
      "band":1,
      "block":[
        100,
        81
      ],
      "type":"Byte",
      "colorInterpretation":"Gray",
      "minimum":0.0,
      "maximum":255.0,
      "mean":154.621,
      "stdDev":54.251,
      "metadata":{
        "":{
          "STATISTICS_MINIMUM":"0",
          "STATISTICS_MAXIMUM":"255",
          "STATISTICS_MEAN":"154.6212",
          "STATISTICS_STDDEV":"54.250980733624",
          "STATISTICS_VALID_PERCENT":"100"
        }
      }
    }
  ],
  "stac":{
    "proj:shape":[
      100,
      100
    ],
    "proj:wkt2":"PROJCRS[\"NAD27 / UTM zone 11N\",\n    BASEGEOGCRS[\"NAD27\",\n        DATUM[\"North American Datum 1927\",\n            ELLIPSOID[\"Clarke 1866\",6378206.4,294.978698213898,\n                LENGTHUNIT[\"metre\",1]]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        ID[\"EPSG\",4267]],\n    CONVERSION[\"Transverse Mercator\",\n        METHOD[\"Transverse Mercator\",\n            ID[\"EPSG\",9807]],\n        PARAMETER[\"Latitude of natural origin\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8801]],\n        PARAMETER[\"Longitude of natural origin\",-117,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8802]],\n        PARAMETER[\"Scale factor at natural origin\",0.9996,\n            SCALEUNIT[\"unity\",1],\n            ID[\"EPSG\",8805]],\n        PARAMETER[\"False easting\",500000,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8806]],\n        PARAMETER[\"False northing\",0,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8807]]],\n    CS[Cartesian,2],\n        AXIS[\"easting\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1]],\n        AXIS[\"northing\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1]],\n    ID[\"EPSG\",26711]]",
    "proj:epsg":26711,
    "proj:projjson":{
      "$schema":"https://proj.org/schemas/v0.7/projjson.schema.json",
      "type":"ProjectedCRS",
      "name":"NAD27 / UTM zone 11N",
      "base_crs":{
        "name":"NAD27",
        "datum":{
          "type":"GeodeticReferenceFrame",
          "name":"North American Datum 1927",
          "ellipsoid":{
            "name":"Clarke 1866",
            "semi_major_axis":6378206.4,
            "inverse_flattening":294.978698213898
          }
        },
        "coordinate_system":{
          "subtype":"ellipsoidal",
          "axis":[
            {
              "name":"Geodetic latitude",
              "abbreviation":"Lat",
              "direction":"north",
              "unit":"degree"
            },
            {
              "name":"Geodetic longitude",
              "abbreviation":"Lon",
              "direction":"east",
              "unit":"degree"
            }
          ]
        },
        "id":{
          "authority":"EPSG",
          "code":4267
        }
      },
      "conversion":{
        "name":"Transverse Mercator",
        "method":{
          "name":"Transverse Mercator",
          "id":{
            "authority":"EPSG",
            "code":9807
          }
        },
        "parameters":[
          {
            "name":"Latitude of natural origin",
            "value":0,
            "unit":"degree",
            "id":{
              "authority":"EPSG",
              "code":8801
            }
          },
          {
            "name":"Longitude of natural origin",
            "value":-117,
            "unit":"degree",
            "id":{
              "authority":"EPSG",
              "code":8802
            }
          },
          {
            "name":"Scale factor at natural origin",
            "value":0.9996,
            "unit":"unity",
            "id":{
              "authority":"EPSG",
              "code":8805
            }
          },
          {
            "name":"False easting",
            "value":500000,
            "unit":"metre",
            "id":{
              "authority":"EPSG",
              "code":8806
            }
          },
          {
            "name":"False northing",
            "value":0,
            "unit":"metre",
            "id":{
              "authority":"EPSG",
              "code":8807
            }
          }
        ]
      },
      "coordinate_system":{
        "subtype":"Cartesian",
        "axis":[
          {
            "name":"Easting",
            "abbreviation":"",
            "direction":"east",
            "unit":"metre"
          },
          {
            "name":"Northing",
            "abbreviation":"",
            "direction":"north",
            "unit":"metre"
          }
        ]
      },
      "id":{
        "authority":"EPSG",
        "code":26711
      }
    },
    "proj:transform":[
      60.0,
      0.0,
      440720.0,
      0.0,
      -60.0,
      3751320.0
    ],
    "raster:bands":[
      {
        "data_type":"uint8",
        "stats":{
          "minimum":0.0,
          "maximum":255.0,
          "mean":154.621,
          "stddev":54.251
        }
      }
    ],
    "eo:bands":[
      {
        "name":"b1",
        "description":"Gray"
      }
    ]
  }
}

Like… the entire file, decoded into vibes. <rainbow>Obsessed.</rainbow> ✨


Example 3: Check if a remote GeoTIFF is a COG 🧚

Bestie, the trick here is to search for LAYOUT=COG in the Image Structure Metadata. The example below uses jq and returns true if the remote image is a COG. πŸ’…

Bash

$ gdal raster info https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif --of=JSON \
| jq '.metadata.IMAGE_STRUCTURE.LAYOUT == "COG"'

PowerShell

> gdal raster info https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif --of=JSON `
| jq '.metadata.IMAGE_STRUCTURE.LAYOUT == \"COG\"'

(Yes, PowerShell needs that backtick instead of the \, and the quotes get escaped. She's picky but she's worth it. 🫢)


Example 4: Return the CRS used by the raster using jq πŸŽ€

Wanna know the authority and code of your CRS without scrolling through a whole PROJJSON novel? Say less.

Bash

gdal raster info in.tif --of json | jq -r '.stac."proj:projjson".id | .authority + ":" + (.code|tostring)'

PowerShell

gdal raster info in.tif --of json | jq -r '.stac.\"proj:projjson\".id | .authority + \":\" + (.code|tostring)'

Slap it in a script, pipe it into your pipeline, main character energy all the way through. πŸ’€βœ¨


AUTHOR

Even Rouault <even.rouault@spatialys.com> β€” the icon who did that. πŸ‘‘


1998-2026


okay bestie that's the whole page, that's a wrap, periodt πŸ’…πŸŒΈ

source: GDAL-RASTER-INFO(1) β€” this one's from Aug 18, 2026, and that's your footer, so screenshot it and go. πŸ¦‹πŸ’–

πŸ“¦ where this page comes from