Open maphew opened 3 years ago
It should be noted in the docs (for both translate and buildvrt) that copied metadata is not edited, and therefore may no longer be true statements. For example b-red.vrt
image of this example now has this note which talks as if all 3 bands are present:
<MDI key="TIFFTAG_IMAGEDESCRIPTION">WorldView-3 Red (0.630 - 0.690) um|WorldView-3 Green (0.510 - 0.580) um|WorldView-3 Blue (0.450 - 0.510) um</MDI>
Gdal can't be expected to check and validate meta statements such as this are still true. It could perhaps add a tag that the meta was copied from source X on such-n-such date.
+1 for this as I just hit it with some orthoimagery too. As is typical, the band descriptions are consistent across all the tiles I'm using, so no concerns around conflict resolution.
A couple notes:
<Description>
elements to .vrt bands after creation, either manually or programmatically (e.g. https://gis.stackexchange.com/questions/428677/how-do-you-label-bands-in-a-gdal-vrt-so-that-their-label-is-recognised-in-qgis).(The VRT schema's at https://gdal.org/drivers/raster/vrt.html.)
Expected behavior and actual behavior.
When using
gdalbuildvrt
to combine images together the Description element of the bands are not copied over. There is other metadata left behind too.I expected build vrt to operate the same way as
gdal_translate
, and copy the description and other metadata.Steps to reproduce the problem.
From a source image that has band description and other metadata, split each band into a single vrt:
Stack the 4 bands we want back together:
Currently I’m hand editing the last stage vrt to put the description back in, but it’s a pain and error prone. At this point I'm personally only interested in retaining the band descriptions but it's easy to imagine scenarios where the other metadata would want to be migrated also.
Attachments:
source-image-rgb.txt - gdalinfo report for the original RGB image interim-image-nir.txt - gdalinfo report for the original near infrared image b-nir.vrt.txt - one of the intermediate VRT bands made by gdal_translate. All metadata intact. rgb-nir.vrt.txt - the result of
gdalbuildvrt
on the interim files, metadata has been stripped.Operating system
Windows 10.
GDAL version and provenance
GDAL 3.1.4, released 2020/10/20 (via Qgis)
Also see gdal-dev thread gdalbuildvrt and band descriptions