<div dir="ltr">Hi,<div><br></div><div>Is there any way in C++ to set the band description?</div><div>I know only <a class="el" href="https://gdal.org/doxygen/classGDALRasterBand.html#a10346d2761b6cd4def98e0430305d5d5" style="color:rgb(61,87,140);font-weight:bold;font-family:Roboto,sans-serif;font-size:14px">SetColorInterpretation</a> that has a limited number of options (<a href="https://gdal.org/doxygen/gdal_8h.html#ace76452d94514561fffa8ea1d2a5968c">https://gdal.org/doxygen/gdal_8h.html#ace76452d94514561fffa8ea1d2a5968c</a>) none of them for near infrared.</div><div><br></div><div>Thanks</div><div>Javier</div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">.___ ._ ..._ .. . ._. .___ .. __ . _. . __.. ... .... ._ .__<br>Entre dos pensamientos racionales <br>hay infinitos pensamientos irracionales.<br><br></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 27 Mar 2021 at 01:08, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Matt,</p>
<p>copying over band description (and other band metadata) in the
-separate case would make sense. Please file an enhancement ticket
about that</p>
<p>Even<br>
</p>
<div>Le 27/03/2021 à 00:40,
<a href="mailto:Matt.Wilkie@yukon.ca" target="_blank">Matt.Wilkie@yukon.ca</a> a écrit :<br>
</div>
<blockquote type="cite">
<div>
<p class="MsoNormal">Hi Folks,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">`gdal_translate -b 1 infile.tif
outfile.vrt` will copy the band 1 description to the output
file.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">`gdalbuild.vrt` on the other hand leaves
the band descriptions behind. Is there a way to have vrt carry
the description across also?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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.)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Split each band into a single vrt:<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">gdal_translate
-b 1 rgb.tif b-red.vrt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">gdal_translate
-b 2 rgb.tif b-grn.vrt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">gdal_translate
-b 3 rgb.tif b-blu.vrt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">gdal_translate
-b 1 infrared.tif b-nir.vrt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal">Stack the 4 bands we want back together:<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">gdalbuildvrt
-separate rgb-nir.vrt b-red.vrt b-grn.vrt b-blu.vrt
b-nir.vrt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<table style="border-collapse:collapse;border:none" cellspacing="0" cellpadding="0" border="1">
<tbody>
<tr>
<td style="width:225pt;border:1pt solid rgb(163,163,163);padding:4pt" width="300" valign="top">
<p class="MsoNormal"><span><img style="width: 2.9583in; height: 1.2083in;" id="gmail-m_2687141495971627265Picture_x0020_2" src="cid:178737c8a124cff311" alt="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" width="284" height="116"></span><span><u></u><u></u></span></p>
</td>
<td style="width:191.25pt;border-top:1pt solid rgb(163,163,163);border-right:1pt solid rgb(163,163,163);border-bottom:1pt solid rgb(163,163,163);border-left:none;padding:4pt" width="262" valign="top">
<p class="MsoNormal"><span><img style="width: 2.6145in; height: 1.1354in;" id="gmail-m_2687141495971627265Picture_x0020_1" src="cid:178737c8a125b16b22" alt="Machine generated alternative text:
@ Band_l Band_2 Band_3" width="251" height="109"></span><span><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal">Cheers,<u></u><u></u></p>
<p class="MsoNormal" style="margin-top:4pt;line-height:115%;vertical-align:middle"><b><span style="font-size:9pt;line-height:115%;font-family:Arial,sans-serif" lang="EN-US">Matt Wilkie</span></b><span style="font-size:9pt;line-height:115%;font-family:Arial,sans-serif" lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Arial,sans-serif" lang="EN-US">Geomatics Analyst<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Arial,sans-serif" lang="EN-US">Environment
<span style="color:rgb(46,116,181)">|</span> Technology, Innovation
and Mapping<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Arial,sans-serif" lang="EN-US">T 867-667-8133
<span style="color:rgb(46,116,181)">|</span> </span><u><span style="font-size:9pt;font-family:Arial,sans-serif"><a href="http://yukon.ca/" target="_blank"><span style="color:windowtext" lang="EN-US">Yukon.ca</span></a><u></u><u></u></span></u></p>
<p class="MsoNormal"><i><span style="font-size:9pt;font-family:Arial,sans-serif">Hours:
08:30-16:30, Tue-Wed: Office, Thu-Fri: Remote.<u></u><u></u></span></i></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre cols="72">--
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>