# `gdal raster info`

Added in version 3.11.

Get information on a raster dataset.

## Synopsis

    Usage: gdal raster info [OPTIONS] <INPUT>

    Return information on a raster dataset.

    Positional arguments:
      -i, --dataset, --input <INPUT>                       Input raster dataset [required]

    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 (default: json)
      --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:
      --oo, --open-option <KEY>=<VALUE>                    Open options [may be repeated]
      --if, --input-format <INPUT-FORMAT>                  Input formats [may be repeated]
      --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

## Description

gdal raster info lists various information about a GDAL supported raster dataset.

The following items will be reported (when known):

- The format driver used to access the file.

- Raster size (in pixels and lines).

- The coordinate system for the file (in OGC WKT).

- The geotransform associated with the file (rotational coefficients are currently not reported).

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

The following options are available:

### Standard options

-f, --of, --format, --output-format json|text

  Which output format to use. Default is JSON.

--mm, --min-max

  Force computation of the actual min/max values for each band in the dataset.

--stats

  Read and display image statistics. Force computation if no statistics are stored in an image.

--approx-stats

  Read and display image statistics. Force computation if no statistics are stored in an image. However, they may be computed based on overviews or a subset of all tiles. Useful if you are in a hurry and don't need precise stats.

--hist

  Report histogram information for all bands.

### Advanced options

--oo <NAME>=<VALUE>

  Dataset open option (format specific).

  May be repeated.

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

--no-gcp

  Suppress ground control points list printing. It may be useful for datasets with huge amount of GCPs, such as L1B AVHRR or HDF4 MODIS which contain thousands of them.

--no-md

  Suppress metadata printing. Some datasets may contain a lot of metadata strings.

--no-ct

  Suppress printing of color table.

--no-rat

  Suppress printing of raster attribute table.

--no-fl

  Only display the first file of the file list.

--checksum

  Force computation of the checksum for each band in the dataset.

--list-mdd

  List all metadata domains available for the dataset.

--mdd <domain>|all

  adds metadata using:

  `domain` Report metadata for the specified domain.

  `all` Report metadata for all domains.

### Esoteric options

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

--no-mask

  Suppress band mask printing. Is implied if `--no-nodata` is specified.

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

## Examples

### Example 1: Getting information on the file `utmsmall.tif` as JSON output

    $ gdal raster info 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",
          "metadata":{
          }
        }
      ],
      "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":{
            "type":"GeographicCRS",
            "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":[
          440720.0,
          60.0,
          0.0,
          3751320.0,
          0.0,
          -60.0
        ],
        "raster:bands":[
          {
            "data_type":"uint8"
          }
        ],
        "eo:bands":[
          {
            "name":"b1",
            "description":"Gray"
          }
        ]
      }
    }

### Example 2: Getting information on the file `utmsmall.tif` as text output, including statistics

    $ gdal raster info --format=text --stats utmsmall.tif
    Driver: GTiff/GeoTIFF
    Files: utmsmall.tif
    Size is 100, 100
    Coordinate System is:
    PROJCRS["NAD27 / UTM zone 11N",
        BASEGEOGCRS["NAD27",
            DATUM["North American Datum 1927",
                ELLIPSOID["Clarke 1866",6378206.4,294.978698213898,
                    LENGTHUNIT["metre",1]]],
            PRIMEM["Greenwich",0,
                ANGLEUNIT["degree",0.0174532925199433]],
            ID["EPSG",4267]],
        CONVERSION["Transverse Mercator",
            METHOD["Transverse Mercator",
                ID["EPSG",9807]],
            PARAMETER["Latitude of natural origin",0,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8801]],
            PARAMETER["Longitude of natural origin",-117,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8802]],
            PARAMETER["Scale factor at natural origin",0.9996,
                SCALEUNIT["unity",1],
                ID["EPSG",8805]],
            PARAMETER["False easting",500000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8806]],
            PARAMETER["False northing",0,
                LENGTHUNIT["metre",1],
                ID["EPSG",8807]]],
        CS[Cartesian,2],
            AXIS["easting",east,
                ORDER[1],
                LENGTHUNIT["metre",1]],
            AXIS["northing",north,
                ORDER[2],
                LENGTHUNIT["metre",1]],
        ID["EPSG",26711]]
    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
      Minimum=0.000, Maximum=255.000, 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