[gdal-dev] gdalbuildvrt and band descriptions

Javier Jimenez Shaw j1 at jimenezshaw.com
Sat Mar 27 04:44:50 PDT 2021


Hi,

Is there any way in C++ to set the band description?
I know only SetColorInterpretation
<https://gdal.org/doxygen/classGDALRasterBand.html#a10346d2761b6cd4def98e0430305d5d5>
that
has a limited number of options (
https://gdal.org/doxygen/gdal_8h.html#ace76452d94514561fffa8ea1d2a5968c)
none of them for near infrared.

Thanks
Javier
.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.



On Sat, 27 Mar 2021 at 01:08, Even Rouault <even.rouault at spatialys.com>
wrote:

> 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.
>
>
>
> [image: 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]
>
> [image: 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 listgdal-dev at lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210327/f45127fc/attachment-0001.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/f45127fc/attachment-0002.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/f45127fc/attachment-0003.png>


More information about the gdal-dev mailing list