<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<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 class="moz-cite-prefix">Le 27/03/2021 à 00:40,
<a class="moz-txt-link-abbreviated" href="mailto:Matt.Wilkie@yukon.ca">Matt.Wilkie@yukon.ca</a> a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:1849f2cef4964313b6ccff723e581271@app-exch2.gov.yk.ca">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Arial",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi Folks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">`gdal_translate -b 1 infile.tif
outfile.vrt` will copy the band 1 description to the output
file.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></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?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></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.)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Split each band into a single vrt:<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas">gdal_translate
-b 1 rgb.tif b-red.vrt<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas">gdal_translate
-b 2 rgb.tif b-grn.vrt<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas">gdal_translate
-b 3 rgb.tif b-blu.vrt<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas">gdal_translate
-b 1 infrared.tif b-nir.vrt<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal">Stack the 4 bands we want back together:<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas">gdalbuildvrt
-separate rgb-nir.vrt b-red.vrt b-grn.vrt b-blu.vrt
b-nir.vrt<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></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?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></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.<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-CA"
lang="EN-US"> <o:p></o:p></span></p>
<table class="MsoNormalTable"
style="border-collapse:collapse;border:none" cellspacing="0"
cellpadding="0" border="1">
<tbody>
<tr>
<td style="width:225.0pt;border:solid #A3A3A3
1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt" width="300"
valign="top">
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:EN-CA"><img
style="width:2.9583in;height:1.2083in"
id="Picture_x0020_2"
src="cid:part1.80C4369F.BEAF3387@spatialys.com"
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 " class="" width="284" height="116"></span><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:EN-CA"><o:p></o:p></span></p>
</td>
<td style="width:191.25pt;border:solid #A3A3A3
1.0pt;border-left:none;padding:4.0pt 4.0pt 4.0pt 4.0pt"
width="262" valign="top">
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:EN-CA"><img
style="width:2.6145in;height:1.1354in"
id="Picture_x0020_1"
src="cid:part2.1BE27DBC.FC699A6C@spatialys.com"
alt="Machine generated alternative text:
@ Band_l Band_2 Band_3 " class="" width="251"
height="109"></span><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:EN-CA"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="mso-fareast-language:EN-CA"
lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
<p class="MsoNormal"
style="margin-top:4.0pt;line-height:115%;text-autospace:none;vertical-align:middle"><b><span
style="font-size:9.0pt;line-height:115%;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA"
lang="EN-US">Matt Wilkie</span></b><span
style="font-size:9.0pt;line-height:115%;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA"
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA"
lang="EN-US">Geomatics Analyst<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA"
lang="EN-US">Environment
<span style="color:#2E74B5">|</span> Technology, Innovation
and Mapping<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA"
lang="EN-US">T 867-667-8133
<span style="color:#2E74B5">|</span> </span><u><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA"><a
href="http://yukon.ca/" moz-do-not-send="true"><span
style="color:windowtext" lang="EN-US">Yukon.ca</span></a><o:p></o:p></span></u></p>
<p class="MsoNormal"><i><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA">Hours:
08:30-16:30, Tue-Wed: Office, Thu-Fri: Remote.<o:p></o:p></span></i></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>