table of contents
- testing 3.12.3+dfsg-1
- unstable 3.12.3+dfsg-1
- experimental 3.13.0~beta1+dfsg-1~exp1
| GDAL-RASTER-INFO(1) | GDAL | GDAL-RASTER-INFO(1) |
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] 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]
--oo, --open-option <KEY>=<VALUE> Open options [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
--crs-format <CRS-FORMAT> Which format to use to report CRS. CRS-FORMAT=AUTO|WKT2|PROJJSON (default: AUTO)
DESCRIPTION¶
gdal raster info lists various information about a GDAL supported raster dataset, and returns them on the standard output stream when used from the command line, or in the output parameter when used from the API.
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 short form AUTH_NAME:CODE when possible, or otherwise OGC WKT2:2019).
- 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.
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. 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.
- --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 command line.
- --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, including its name, ID, type and area of use will be reported. Otherwise a full WKT2:2019 definition will be reported.
NOTE:
- --hist
- Report histogram information for all bands.
- --list-mdd
- 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. It may be useful for datasets with huge amount of GCPs, such as L1B AVHRR or HDF4 MODIS which contain thousands of them.
- --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.
- --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).
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 information on the file utmsmall.tif as JSON output, including statistics¶
$ 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"
}
]
}
}
Example 3: Check if a remote GeoTIFF is a COG¶
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\"'
Example 4: Return the CRS used by the raster using jq¶
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)'
AUTHOR¶
Even Rouault <even.rouault@spatialys.com>
COPYRIGHT¶
1998-2026
| April 15, 2026 |