<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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 Definitions */
@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;}
/* Style Definitions */
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;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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]-->
</head>
<body lang="EN-CA" link="#0563C1" vlink="#954F72">
<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 lang="EN-US" style="mso-fareast-language:EN-CA"> <o:p></o:p></span></p>
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;border:none">
<tbody>
<tr>
<td width="300" valign="top" style="width:225.0pt;border:solid #A3A3A3 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:EN-CA"><img width="284" height="116" style="width:2.9583in;height:1.2083in" id="Picture_x0020_2" src="cid:image001.png@01D7225E.B2B0CB40" 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 "></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 width="262" valign="top" style="width:191.25pt;border:solid #A3A3A3 1.0pt;border-left:none;padding:4.0pt 4.0pt 4.0pt 4.0pt">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:EN-CA"><img width="251" height="109" style="width:2.6145in;height:1.1354in" id="Picture_x0020_1" src="cid:image002.png@01D7225E.B2B0CB40" alt="Machine generated alternative text:
@ Band_l
Band_2
Band_3 "></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 lang="EN-US" style="mso-fareast-language:EN-CA"> <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 lang="EN-US" style="font-size:9.0pt;line-height:115%;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA">Matt Wilkie</span></b><span lang="EN-US" style="font-size:9.0pt;line-height:115%;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA">Geomatics Analyst<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA">Environment
<span style="color:#2E74B5">|</span> Technology, Innovation and Mapping<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-CA">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/"><span lang="EN-US" style="color:windowtext">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>
</body>
</html>