<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: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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.Code, li.Code, div.Code
        {mso-style-name:Code;
        mso-style-link:"Code Char";
        margin:0in;
        margin-bottom:.0001pt;
        background:#F2F2F2;
        font-size:12.0pt;
        font-family:"Courier New";}
span.CodeChar
        {mso-style-name:"Code Char";
        mso-style-link:Code;
        font-family:"Courier New";
        background:#F2F2F2;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Perhaps try editing the .vrt file with a text editor and changing the nodata value by hand?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Matt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> fwtools-bounces@lists.maptools.org [mailto:fwtools-bounces@lists.maptools.org]
<b>On Behalf Of </b>Ari Simmons<br>
<b>Sent:</b> Wednesday, June 10, 2015 10:19 AM<br>
<b>To:</b> Chaitanya kumar CH<br>
<b>Cc:</b> fwtools@lists.maptools.org<br>
<b>Subject:</b> Re: [FWTools] gdal_merge with a specific pixel value clipped/removed<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">Ok - so gdal_translate works great! Thanks!<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">HOWEVER, the removal of value 230 245 255 is still no happening...when I put in:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">&gt;&gt;gdalbuildvrt -srcnodata &quot;230 245 255&quot; tif_index.vrt *.tif<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">I get a .vrt with Band 1 = 0 (instead of 230) and the full 3 Band value becoming (0 245 255)....not what I expected. I expected it to become &quot;NoData&quot;....<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On Tue, Jun 9, 2015 at 9:17 PM, Chaitanya kumar CH &lt;<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>&gt; wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">Ari,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">The vrt is an xml file that represents a single raster dataset made up of one or many rasters. So, it is already merged. You can read it using any good text editor.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">You only have to run gdal_translate to convert it to a tif.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<p class="MsoNormal">gdal_translate -of GTiff tif_index.vrt tif_index.tif<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, Jun 10, 2015 at 2:40 AM Ari Simmons &lt;<a href="mailto:ari.ucb.fire@gmail.com" target="_blank">ari.ucb.fire@gmail.com</a>&gt; wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Interesting...ok, so (knowing nothing about .vrt's and having a bunch of .tiff's) I ran this:<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">&gt;&gt;gdalbuildvrt -srcnodata &quot;230 245 255&quot; tif_index.vrt *.tif<br>
0...10...20...30...40...50...60...70...80...90...100 - done.<o:p></o:p></p>
</div>
<p class="MsoNormal">then<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">&gt;&gt; gdal_merge -o merged_result.tif *.vrt<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">and got<br>
<br>
ERROR 4: `*.vrt' does not exist in the file system,<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
and is not recognised as a supported dataset name.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">I'm on OSGEO4W too..<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On Tue, Jun 9, 2015 at 1:24 PM, &lt;<a href="mailto:Matt.Wilkie@gov.yk.ca" target="_blank">Matt.Wilkie@gov.yk.ca</a>&gt; wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">The error is because you need to quote the argument values to keep them from being interpreted as filenames:<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; gdal_merge -n “230 245 255” ...<br>
<br>
However gdal_merge can't use different nodata values for each band. You need to pre-process the files before merging. This worked for me here:<br>
<br>
Create&nbsp; VRT (virtual raster) file for the input file(s):<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; gdalbuildvrt -srcnodata &quot;230 245 255”&quot;&nbsp; infile1.vrt&nbsp; infile1.tif<br>
<br>
Then feed the .vrt's to gdal_merge:<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; gdal_merge -of merged_result.tif infile1.vrt infile2.vrt ...<br>
<br>
<br>
You may need to switch from fwtools to Osgeo4w (if on Windows) to get gdalbuildvrt.<br>
<br>
Cheers,<br>
<br>
--<br>
matt wilkie<br>
--------------------------------------------<br>
Geomatics Analyst<br>
Information Management and Technology<br>
Yukon Department of Environment<br>
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9<br>
<a href="tel:867-667-8133" target="_blank">867-667-8133</a> Tel * <a href="tel:867-393-7003" target="_blank">
867-393-7003</a> Fax<br>
<a href="http://environmentyukon.gov.yk.ca/geomatics/" target="_blank">http://environmentyukon.gov.yk.ca/geomatics/</a><br>
--------------------------------------------<br>
<br>
<br>
<br>
-----------------------------<br>
<br>
From: <a href="mailto:fwtools-bounces@lists.maptools.org" target="_blank">fwtools-bounces@lists.maptools.org</a> [mailto:<a href="mailto:fwtools-bounces@lists.maptools.org" target="_blank">fwtools-bounces@lists.maptools.org</a>] On Behalf Of Ari Simmons<br>
Sent: Tuesday, June 09, 2015 12:43 PM<br>
To: <a href="mailto:fwtools@lists.maptools.org" target="_blank">fwtools@lists.maptools.org</a><br>
Subject: [FWTools] gdal_merge with a specific pixel value clipped/removed<br>
<br>
I have a large set of .tif files and I need to merge/mosaic them all into one .tif with the no-data value removed (i.e. value 230, 245, 255). However, when I put this in...pixel '230, 245, 255' becomes '0, 245, 255').<br>
I am trying to get NO PIXEL returned for 230, 245, 255. Is that possible?<br>
I:\TFS_6\trial_merge&gt;gdal_merge.py -o test.tif -n 230 245 255 file1.tif file2.tif<br>
<br>
ERROR 4: `245' does not exist in the file system,<br>
and is not recognised as a supported dataset name.<br>
<br>
ERROR 4: `255' does not exist in the file system,<br>
and is not recognised as a supported dataset name.<br>
<br>
0...10...20...30...40...50...60...70...80...90...100 - done.<o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
FWTools mailing list<br>
<a href="mailto:FWTools@lists.maptools.org" target="_blank">FWTools@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/fwtools" target="_blank">http://lists.maptools.org/mailman/listinfo/fwtools</a><br>
<a href="http://fwtools.maptools.org/" target="_blank">http://fwtools.maptools.org/</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">-- <o:p></o:p></span></p>
</div>
<p><span style="color:#888888">Chaitanya Kumar CH<o:p></o:p></span></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</body>
</html>