[gdal-dev] gdal_edit.py question
Scott
public at postholer.com
Thu Sep 12 11:41:01 PDT 2024
Greetings,
I need some help with gdal_edit. If I add meta data each time I add a
band to a raster, only the last meta edit is present. Here's the
scenario GDAL 3.9.1, gdal_edit.py is 3.6.2, Debian 12:
# create empty 2-band raster with existing prototype:
gdal_create -if src1.tif -bands 2 result.tif
# add tif to band 1 and add meta data for it:
gdalwarp -q -srcband 1 -dstband 1 -t_srs EPSG:4326 src1.tif result.tif
gdal_edit.py -mo "BAND1=meta1" result.tif
# add another tif to band 2 and add meta data for it:
gdalwarp -q -srcband 1 -dstband 2 -t_srs EPSG:4326 src2.tif result.tif
gdal_edit.py -mo "BAND2=meta2" result.tif
# Now, the interesting part. Only BAND2 meta data is present. BAND1 is
missing.
gdalinfo result.tif
# if I add all the meta data at once, it works fine
gdal_edit.py -mo "BAND1=meta1" -mo "BAND2=meta2" result.tif
Another unrelated thing, if I try to add a second band to an existing
single band raster using gdalwarp, it throws an error saying the second
band doesn't exist. That's understandable, hence gdal_create. The
downside is, if you're working with an unknown number of bands, you
can't just add it. This would be an extremely useful feature when
working with NETCDF, HDF, etc.
Thanks!
Scott
--
www.postholer.com
More information about the gdal-dev
mailing list