[gdal-dev] Is there a reference documentation for GDALMetadata structure?

Even Rouault even.rouault at spatialys.com
Mon May 27 10:51:51 PDT 2019


On lundi 27 mai 2019 17:58:34 CEST Andrea Aime wrote:
> Hi Jukka,
> thank you for following up. I believe that provides information for the PAM
> dataset, which
> is normally a sidecar containing statistical information such as
> min/max/histograms.
> The GDAL metadata TIFF tag instead normally contains other information,
> such as scale/offset,
> band names, units, and uses a XML that has a different structure.
> 
> Looking into the code there is something around here:
> https://github.com/OSGeo/gdal/blob/master/gdal/frmts/gtiff/geotiff.cpp#L1372
> 6

Andrea,

If you're looking for the specification of the GDAL metadata TIFF tag (which 
is different from PAM .aux.xml), then the code will be your best friend as I 
don't think there's a document describing it, together with experimentation

Here's how to set the names of a 2-band TIFF

<GDALMetadata>
  <Item name="DESCRIPTION" sample="0" role="description">my_band_1_name</Item>
  <Item name="DESCRIPTION" sample="1" role="description">my_band_2_name</Item>
</GDALMetadata>

The output of gdalinfo will be:

Band 1 Block=20x20 Type=Byte, ColorInterp=Gray
  Description = my_band_1_name
Band 2 Block=20x20 Type=Byte, ColorInterp=Gray
  Description = my_band_2_name

The samples with '.' you mention are corrupted. GDAL shouldn't produce such 
files.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list