[gdal-dev] keep metadata tags when creating multiband file
Thornton, Michele M.
thorntonmm at ornl.gov
Wed Oct 23 06:00:46 PDT 2013
Hello List,
Apologies if this is a repeat post. Not sure that I was subscribed properly.
I have a number of individual Landsat bands that I'm converting to GeoTiff and would then like to merge to a multiband file using either gdal_merge.py or another gdal utility (gdalbuildvrt, gdal_translate). In the individually derived geotif files, I am able to internally "label" the corresponding Landsat band by creating a metadata tag. For example, in using the following gdal_translate command from a file that is Landsat data for Band 1 called landsat.b1.dat:
gdal_translate -of GTiff -strict -stats -mo "Band = LandsatBand ${f: -5:1}" -co "COMPRESS=LZW" -co "PROFILE=GeoTIFF" $f $f.tif
This creates a metadata tag in the tif file:
-------------------------------------------------
Metadata:
AREA_OR_POINT=Area
Band =LandsatBand 1
And there is a separate .aux.xml for each of the tif files:
-------------------------------------------------------------------
<PAMDataset>
<Metadata>
<MDI key="Band ">LandsatBand 1</MDI>
</Metadata>
<PAMRasterBand band="1">
<Metadata>
<MDI key="STATISTICS_MAXIMUM">255</MDI>
<MDI key="STATISTICS_MEAN">40.826976974681</MDI>
<MDI key="STATISTICS_MINIMUM">0</MDI>
<MDI key="STATISTICS_STDDEV">31.471508896152</MDI>
</Metadata>
</PAMRasterBand>
Now, I have for example 6 such separate files with Landsat bands labeled 1-5 and 7 respectively. I would like to keep these metadata tags (Band =LandsatBand #) when I derive a single multiband file to ensure that legacy in the file metadata. In other words, more internal metadata information than Band_1 - Band_6 when in fact the bands are Landsat bands 1-5, and 7.
So far, gdal_merge.py and the other gdal utilities drop the metadata tags. I've tried the flag -co "PROFILE=GeoTIFF" in gdal_merge.py with no luck. Is it possible to create a multiband file and retain the metadata band information?
Thanks in advance,
Michele
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131023/1285dd74/attachment.html>
More information about the gdal-dev
mailing list