[gdal-dev] gdalbuildvrt and band descriptions

Even Rouault even.rouault at spatialys.com
Fri Mar 26 17:08:31 PDT 2021


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, Matt.Wilkie at yukon.ca 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
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210327/c4e9231f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5832 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210327/c4e9231f/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 3692 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210327/c4e9231f/attachment-0001.png>


More information about the gdal-dev mailing list