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

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Mon May 27 10:17:24 PDT 2019


Hi Andrea,

I have understood that PAM may contain any metadata that cannot be stored into the file format itself.

I made a test but I honestly do not know what it proves, if anything.  However, if I tell GDAL to handle GeoTIFF as read-only and make some edits with

gdal_edit -ro -mo DATUM=WGS84 test.tif
gdal_edit -ro -scale 299 -offset 10 test.tif

then I get a tif.aux.xml file that contains

<PAMDataset>
  <Metadata>
    <MDI key="DATUM">WGS84</MDI>
  </Metadata>
  <PAMRasterBand band="1">
    <Offset>10</Offset>
    <Scale>299</Scale>
  </PAMRasterBand>
  <PAMRasterBand band="2">
    <Offset>10</Offset>
    <Scale>299</Scale>
  </PAMRasterBand>
  <PAMRasterBand band="3">
    <Offset>10</Offset>
    <Scale>299</Scale>
  </PAMRasterBand>
</PAMDataset>

If I run the commands without -ro then the tags of the GeoTIFF file are edited and no sidecar file appears.

-Jukka-



Lähettäjä: Andrea Aime <andrea.aime at geo-solutions.it>
Lähetetty: maanantai 27. toukokuuta 2019 18.59
Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi>
Kopio: gdal-dev at lists.osgeo.org
Aihe: Re: [gdal-dev] Is there a reference documentation for GDALMetadata structure?

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#L13726

I see explicit treatment for scale/offset and a few others, not sure if there is anything else?
Like, if a band had a custom name, would it show up in the GDALMetadata structure in a significant way?
From my previous example, things like:

 <Item name="Band_1">Max Band_1</Item>.
    <Item name="Band_2">Min Band_1</Item>.
    <Item name="Band_3">Mean Band_1</Item>.
    <Item name="Band_4">SD Band_1</Item>.
    <Item name="Band_5">MASD Band_1</Item>.
    <Item name="Band_6">Valid Inputs</Item>.

are they actually used or just treated as "random strings"?
Looking at a GDALInfo output it looks like of the second, but maybe I'm missing something:

Metadata:
  AREA_OR_POINT=Area
  Band_1=Max Band_1
  Band_2=Min Band_1
  Band_3=Mean Band_1
  Band_4=SD Band_1
  Band_5=MASD Band_1
  Band_6=Valid Inputs
  UNITS=m
...
Band 1 Block=10x10 Type=Int32, ColorInterp=Gray
  NoData Value=-9999
  Offset: 0,   Scale:0.0001
Band 2 Block=10x10 Type=Int32, ColorInterp=Undefined
  NoData Value=-9999
  Offset: 0,   Scale:0.0001
Band 3 Block=10x10 Type=Int32, ColorInterp=Undefined
  NoData Value=-9999
  Offset: 0,   Scale:0.0001
Band 4 Block=10x10 Type=Int32, ColorInterp=Undefined
  NoData Value=-9999
  Offset: 0,   Scale:0.0001
Band 5 Block=10x10 Type=Int32, ColorInterp=Undefined
  NoData Value=-9999
  Offset: 0,   Scale:0.0001
Band 6 Block=10x10 Type=Int32, ColorInterp=Undefined
  NoData Value=-9999
  Offset: 0,   Scale:0.0001


Cheers
Andrea

On Mon, May 27, 2019 at 1:11 PM jratike80 <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>> wrote:
Hi,

Perhaps here
https://github.com/OSGeo/gdal/blob/master/gdal/gcore/gdalpamdataset.cpp

-Jukka Rahkonen-


geowolf wrote
> Hi,
> I was wondering if there is any documentation on what a GDALMetadata XML
> structure might contain, both in terms
> of element/attributes, and key names?
> ...





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190527/d92884b6/attachment-0001.html>


More information about the gdal-dev mailing list