Matt,

copying over band description (and other band metadata) in the -separate case would make sense. Please file an enhancement ticket about that

Even

Le 27/03/2021 à 00:40, [email protected] a écrit :

Hi Folks,

`gdal_translate -b 1 infile.tif outfile.vrt` will copy the band 1 description to the output file.

`gdalbuild.vrt` on the other hand leaves the band descriptions behind. Is there a way to have vrt carry the description across also?

The project behind the question is to keep only the 4 bands of interest from 6 bands spread across two files (Red, Green, Blue and Near infrared) and merge them into a single output file, and keep all their metadata. VRT is a good intermediary except for it drops the band descriptions. (And some other metadata too, but I’m less concerned about that.)

Split each band into a single vrt:

gdal_translate -b 1 rgb.tif b-red.vrt

gdal_translate -b 2 rgb.tif b-grn.vrt

gdal_translate -b 3 rgb.tif b-blu.vrt

gdal_translate -b 1 infrared.tif b-nir.vrt

Stack the 4 bands we want back together:

gdalbuildvrt -separate rgb-nir.vrt b-red.vrt b-grn.vrt b-blu.vrt b-nir.vrt

Currently I’m hand editing the last stage vrt to put the description back in, but it’s a pain and error prone. Is there a better way?

In the end I want arcgis desktop users to see something like the image on the left (plus the additional NIR band) instead of the right, which is what happens when there’s no description.

Machine generated alternative text: WorldView-3 Blue (0.450 - 0.510) um WorldView-3 Green (0.510 - 0.380) um WorldView-3 Red (0.630 - 0.690) um

        

Machine generated alternative text: @ Band_l Band_2 Band_3

Cheers,

*Matt Wilkie*

Geomatics Analyst

Environment | Technology, Innovation and Mapping

T 867-667-8133 | _Yukon.ca <http://yukon.ca/>_

/Hours: 08:30-16:30, Tue-Wed: Office, Thu-Fri: Remote./


_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to