<div dir="ltr"><div><div>Matt <br><br>Not sure I see how...<br><br> <ComplexSource><br> <SourceFilename relativeToVRT="1">TEX_N00E006.tif</SourceFilename><br> <SourceBand>1</SourceBand><br> <SourceProperties RasterXSize="1200" RasterYSize="1200" DataType="Byte" BlockXSize="1200" BlockYSize="2" /><br> <SrcRect xOff="0" yOff="0" xSize="1200" ySize="1200" /><br> <DstRect xOff="0" yOff="0" xSize="1200" ySize="1200" /><br> <NODATA>230</NODATA><br><br></div>Do you mean change <br><br> <NODATA>230</NODATA><br><br></div>to <br><br> <NODATA>230 245 255</NODATA><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 10, 2015 at 10:20 AM, <span dir="ltr"><<a href="mailto:Matt.Wilkie@gov.yk.ca" target="_blank">Matt.Wilkie@gov.yk.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-CA">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Perhaps try editing the .vrt file with a text editor and changing the nodata value by hand?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Matt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> <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>]
<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> <a href="mailto:fwtools@lists.maptools.org" target="_blank">fwtools@lists.maptools.org</a><br>
<b>Subject:</b> Re: [FWTools] gdal_merge with a specific pixel value clipped/removed<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Ok - so gdal_translate works great! Thanks!<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">HOWEVER, the removal of value 230 245 255 is still no happening...when I put in:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">>>gdalbuildvrt -srcnodata "230 245 255" tif_index.vrt *.tif<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></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 "NoData"....<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, Jun 9, 2015 at 9:17 PM, Chaitanya kumar CH <<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>> wrote:<u></u><u></u></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,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">You only have to run gdal_translate to convert it to a tif.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">gdal_translate -of GTiff tif_index.vrt tif_index.tif<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, Jun 10, 2015 at 2:40 AM Ari Simmons <<a href="mailto:ari.ucb.fire@gmail.com" target="_blank">ari.ucb.fire@gmail.com</a>> wrote:<u></u><u></u></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:<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">>>gdalbuildvrt -srcnodata "230 245 255" tif_index.vrt *.tif<br>
0...10...20...30...40...50...60...70...80...90...100 - done.<u></u><u></u></p>
</div>
<p class="MsoNormal">then<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">>> gdal_merge -o merged_result.tif *.vrt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">and got<br>
<br>
ERROR 4: `*.vrt' does not exist in the file system,<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
and is not recognised as a supported dataset name.<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">I'm on OSGEO4W too..<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, Jun 9, 2015 at 1:24 PM, <<a href="mailto:Matt.Wilkie@gov.yk.ca" target="_blank">Matt.Wilkie@gov.yk.ca</a>> wrote:<u></u><u></u></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>
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 VRT (virtual raster) file for the input file(s):<br>
<br>
gdalbuildvrt -srcnodata "230 245 255”" infile1.vrt infile1.tif<br>
<br>
Then feed the .vrt's to gdal_merge:<br>
<br>
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>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.<u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></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><span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
<div>
<p class="MsoNormal"><span style="color:#888888">-- <u></u><u></u></span></p>
</div>
<p><span style="color:#888888">Chaitanya Kumar CH<u></u><u></u></span></p>
</font></span></blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</blockquote></div><br></div>