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] [-hist] [-nogcp] [-nomd] [-norat] [-noct] [-checksum] [-proj4] [-listmdd] [-mdd domain] [-sd subdataset] [-oo NAME=VALUE] [-if format] datasetname [corner_coordinate]

PARAMETERS

--help-general
    Display brief usage instructions.

-json
    Format output in JSON.

-mm
    Report the minimum and maximum pixel values for each band.

-stats
    Calculate and report image statistics (min, max, mean, stddev) for each band.

-hist
    Calculate and report a histogram for each band.

-nogcp
    Suppress GCP (Ground Control Points) reporting.

-nomd
    Suppress metadata reporting.

-norat
    Suppress reporting of raster attribute table for indexed files.

-noct
    Suppress reporting of color table for indexed files.

-checksum
    Force computation of checksum for each band.

-proj4
    Report the PROJ.4 string for the CRS.

-listmdd
    List all metadata domains available on the dataset.

-mdd domain
    Report metadata for the specified domain.

-sd subdataset
    Report information for the specified subdataset (when dataset is a multi-dataset file).

-oo NAME=VALUE
    Passes a driver specific option to the GDAL driver. Multiple -oo options may be listed.

-if format
    Force input file format.

datasetname
    The name of the raster dataset to be inspected.

corner_coordinate
    Optional corner coordinate (ul, ur, lr, ll) for pixel value reporting.

DESCRIPTION

The `gdalinfo` command provides comprehensive metadata and summary information about raster datasets that GDAL supports. It can be used to inspect image files, geospatial datasets, and other raster-based formats to understand their structure, contents, georeferencing, projection, and other relevant properties. The output includes driver name, file size, image dimensions, number of bands, data types, geotransform matrix, coordinate reference system (CRS), and metadata. It can also report pixel values at specified locations and offer information about overviews, color tables, and other specific features of the dataset. `gdalinfo` is essential for understanding and verifying the characteristics of raster data before processing it with other GDAL utilities or GIS software. It can be used both for quickly checking key aspects of a file or for detailed exploration of its inner workings. Knowing how to interpret the output of `gdalinfo` is fundamental for effective geospatial data management and analysis using GDAL.

CAVEATS

The accuracy of statistics and min/max values depends on the underlying data and may not always be reliable for large datasets.

COORDINATE SYSTEMS

gdalinfo provides detailed information about the coordinate system of the raster data, including the projection, datum, and units. This information is crucial for georeferencing and transforming the data to other coordinate systems.

BAND INFORMATION

For multi-band images, gdalinfo reports the data type, color interpretation, and other properties of each band individually. Understanding band characteristics is essential for tasks like image analysis and visualization.

Example:
Band 1 Block=128x128 Type=Byte, ColorInterp=Red

HISTORY

gdalinfo has been a core utility in the GDAL library since its initial release. It serves as a fundamental tool for understanding geospatial raster data. Over time, it has been expanded to support an increasing number of raster formats and metadata types, reflecting the evolution of geospatial data standards. The JSON output option and enhanced statistical reporting are relatively recent additions.

SEE ALSO

Copied to clipboard