gdalinfo
Get information about raster or vector datasets
TLDR
List all supported raster formats
List information about a specific raster dataset
List information about a specific raster dataset in JSON format
Show histogram values of a specific raster dataset
List information about a Web Map Service (WMS)
List information about a specific dataset of a Web Map Service (WMS)
SYNOPSIS
gdalinfo [OPTIONS] <datasetname>
gdalinfo displays detailed metadata and structural information about a GDAL-supported raster <datasetname>. Various OPTIONS can be used to control the output format and content.
PARAMETERS
-json
Output all information in structured JSON format.
-mdd <domain>|
Report metadata for a specific domain or for all domains.
-sd <subdataset>
Select a specific subdataset to report information about.
-oo <NAME=VALUE>
Set a dataset open option, e.g., -oo NUM_THREADS=ALL_CPUS.
-proj4
Report the coordinate system in PROJ.4 format.
-wkt_format <WKT1|WKT2_2015|WKT2_2018>
Control the WKT format version for the projection output.
-stats
Force computation and reporting of band statistics (min, max, mean, std dev).
-hist
Force computation and reporting of band histograms.
-nogcp
Suppress reporting of Ground Control Points (GCPs).
-nomd
Suppress reporting of metadata.
-norat
Suppress reporting of the Raster Attribute Table (RAT).
-noct
Suppress reporting of the Color Table.
-nocpxb
Suppress complex band information (e.g., Fourier transform coefficients).
-checksum
Compute and report the checksum for each band.
-overview
Report information about dataset overviews.
-listmdd
List all available metadata domains for the dataset.
-listmd
List available metadata items for the dataset (GDAL 3.9+).
-if <format>
Restrict the drivers used to open the dataset to a specific format.
-show_md_domain <domain>
Show metadata for a specific domain (GDAL 3.9+).
-config <key> <value>
Set a GDAL configuration option, e.g., -config GDAL_CACHEMAX 512.
-setmd <key=value>
Set a metadata item for the dataset.
-unsetmd <key>
Unset a metadata item for the dataset.
--version
Display the GDAL version and exit.
--formats
List all supported GDAL raster formats and exit.
--help-general
Display generic GDAL command-line options.
DESCRIPTION
gdalinfo is a fundamental command-line utility within the GDAL (Geospatial Data Abstraction Library) suite. Its primary purpose is to display comprehensive information about georeferenced raster datasets. It can read a vast array of raster formats, including GeoTIFF, NetCDF, HDF5, JPEG2000, and many others supported by GDAL drivers. The output typically includes crucial details such as the dataset's driver and file name, image dimensions (width and height), coordinate system (expressed in WKT or PROJ.4 format), georeferencing transformation (geotransform or Ground Control Points - GCPs), metadata domains, and information about each raster band. For each band, gdalinfo can report its data type, color interpretation, statistics (min, max, mean, standard deviation), histogram, and no-data value. This command is invaluable for quickly inspecting geospatial data without requiring a full GIS application, aiding in data validation, debugging data issues, and providing essential parameters for scripting automated geospatial workflows. It allows users to quickly understand the characteristics of their raster files, which is critical for subsequent processing steps like reprojection, mosaicking, or analysis.
CAVEATS
Computing statistics or histograms (using -stats
or -hist
options) can be computationally intensive and time-consuming for very large datasets, as it requires reading the entire raster. The default text output can be highly verbose; for scripting and machine parsing, the -json
option is highly recommended to obtain structured, machine-readable output. gdalinfo is part of the GDAL suite and requires the GDAL libraries to be installed and accessible on the system.
UNDERSTANDING GDAL'S DATA MODEL
gdalinfo's output directly reflects GDAL's internal data model. A GDAL dataset typically consists of:
Georeferencing: Defined by either a geotransform (affine transformation from pixel coordinates to georeferenced coordinates) or Ground Control Points (GCPs).
Coordinate System: Specifies the spatial reference system (e.g., WGS84, UTM Zone).
Raster Bands: One or more bands, each with a specific data type (e.g., Byte, Int16, Float32), color interpretation (e.g., Red, Green, Blue, Gray), and potentially statistics and histograms.
Metadata: Key-value pairs providing additional information, often organized into domains (e.g., 'IMAGERY_DOMAIN', 'RPC').
Overviews: Lower-resolution versions of the dataset for faster rendering at zoomed-out scales.
TYPICAL USE CASES
gdalinfo is an indispensable tool for:
Verifying the spatial reference system (projection) and geographic extent of a raster file.
Inspecting the number of bands, their data types, and color interpretations.
Checking for the presence of existing metadata, overviews, or no-data values.
Debugging issues with geospatial data, such as incorrect georeferencing or missing projections.
Automating data validation and parameter extraction within scripts for large-scale geospatial processing pipelines.
HISTORY
gdalinfo is a foundational utility within the GDAL (Geospatial Data Abstraction Library) project, which was initiated by Frank Warmerdam in 1998. GDAL rapidly evolved into the de-facto open-source standard for reading and writing a vast array of geospatial raster data formats, and later expanded to include vector support (OGR). gdalinfo has been a core component of GDAL from its very beginning, providing essential insights into the structure and metadata of raster datasets. Over its development history, new capabilities such as the -json
output option (introduced in GDAL 2.2), improved WKT format handling, and expanded metadata domain support have been added, enhancing its utility for both interactive use and automated scripting in modern geospatial workflows.
SEE ALSO
gdal_translate(1), gdalwarp(1), ogrinfo(1), gdalsummary(1), gdaladdo(1)