LinuxCommandLibrary

gdalinfo

Get information about raster or vector datasets

TLDR

List all supported raster formats

$ gdalinfo --formats
copy

List information about a specific raster dataset
$ gdalinfo [path/to/input.tif]
copy

List information about a specific raster dataset in JSON format
$ gdalinfo -json [path/to/input.tif]
copy

Show histogram values of a specific raster dataset
$ gdalinfo -hist [path/to/input.tif]
copy

List information about a Web Map Service (WMS)
$ gdalinfo WMS:[https://services.meggsimum.de/geoserver/ows]
copy

List information about a specific dataset of a Web Map Service (WMS)
$ gdalinfo WMS:[https://services.meggsimum.de/geoserver/ows] -sd [4]
copy

SYNOPSIS

gdalinfo [--help-general] [-json] [-mm] [-stats] [-approx_stats] [-nogcp] [-noct] [-norat] [-nooverview] [-checksum] [-histograms] [-proj4] [-listmdd] [-mdd <name>=<value>]* [-oo NAME=VALUE]* <filename>

PARAMETERS

--help-general
    Display general help message

-json
    Output results in JSON format

-mm
    Force computation and display of valid min/max values

-stats
    Estimate and display image statistics (min/max/mean/stddev)

-approx_stats
    Approximate statistics for large images (faster)

-nogcp
    Suppress ground control points output

-noct
    Suppress color table output

-norat
    Suppress raster attribute table output

-nooverview
    Skip overview (pyramid) information

-checksum
    Report checksum (CRC32) for each band

-histograms
    Report image histograms

-proj4
    Report projection in legacy PROJ.4 format

-listmdd
    List all metadata domains available

-mdd <name>=<value>
    Add custom metadata domain entry

-oo NAME=VALUE
    Dataset open option (format-specific)

DESCRIPTION

The gdalinfo command is a key utility from the GDAL (Geospatial Data Abstraction Library) toolkit, designed to inspect and summarize information about raster geospatial datasets. It provides comprehensive details including dataset dimensions, geotransform, projection information, band descriptions, color tables, metadata, ground control points (GCPs), and overviews.

When invoked on a file such as a GeoTIFF or other supported format, it outputs human-readable text detailing the spatial reference system (SRS), pixel data types, no-data values, and more. Optional flags enable computation of image statistics (min/max/mean/stddev), histograms, checksums, or JSON-formatted output for programmatic use. This makes it invaluable for data validation, format verification, and debugging in GIS workflows.

Supporting hundreds of raster drivers, gdalinfo handles formats from GeoTIFF and JPEG2000 to cloud-optimized GeoTIFF (COG) and virtual rasters (VRT). It respects open options for format-specific overrides and can process multi-band or multi-file datasets seamlessly.

CAVEATS

Computing statistics on very large rasters may consume significant memory/time; use -approx_stats for efficiency. Some formats lack full metadata support. Multi-file datasets require all files present.

EXAMPLE USAGE

gdalinfo image.tif
Basic info dump.
gdalinfo -stats -json image.tif
JSON with statistics.

HISTORY

Part of GDAL since its inception around 1998 by Frank Warmerdam. Evolved with GDAL releases; major enhancements in v2.0 (2013) for better stats/JSON, v3.0 (2019) for PROJ6 integration and COG support. Widely used in open-source GIS.

SEE ALSO

gdal_translate(1), gdalwarp(1), ogrinfo(1), gdal_retile(1)

Copied to clipboard