<p>Thanks! it works</p>
<p>a follow up &quot;bonus&quot; question<br>
I get the same problem when trying to create a mosaic by warping to images to a new dataset.</p>
<p>my code is basically copied from the &quot;GDAL Warp API Tutorial&quot; page <a href="http://www.gdal.org/warptut.html">http://www.gdal.org/warptut.html</a></p>
<p>and adding:<br>
psWarpOptions-&gt;padfSrcNoDataReal = new double(0);<br>
</p>
<div class="gmail_quote">On Feb 29, 2012 11:03 AM, &quot;Even Rouault&quot; &lt;<a href="mailto:even.rouault@mines-paris.org">even.rouault@mines-paris.org</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Selon Ophir Yoktan &lt;<a href="mailto:ophiry@gmail.com">ophiry@gmail.com</a>&gt;:<br>
<br>
Several errors :<br>
1) The NoDataValue and HideNoDataValue elements are only valid under the<br>
VRTRasterBand element, not SimpleSource<br>
2) You want to change SimpleSource to ComplexSource, and add a<br>
&lt;NODATA&gt;0&lt;/NODATA&gt; element in it. (well basically rename your current<br>
NoDataValue to NODATA.<br>
<br>
<br>
&gt; I&#39;m trying to build a mosaic, and I rely on the NoDataValue feature to<br>
&gt; treat some parts of the image as transparent.<br>
&gt; However, it appears that GDAL doesn&#39;t work as expected.<br>
&gt;<br>
&gt; I also created a very simple test case using a vrt dataset and<br>
&gt; gdal_translate - and I get the same results (that is - the 2nd image draws<br>
&gt; over the 1st image, ignoring &quot;transparent areas&quot;)<br>
&gt;<br>
&gt; I have to 100X100 image files with a white marking (different in each file)<br>
&gt; over black background (black being exactly equal to 0)<br>
&gt; I built a simple vrt file:<br>
&gt;<br>
&gt;     &lt;VRTDataset rasterXSize=&quot;100&quot; rasterYSize=&quot;100&quot;&gt;<br>
&gt;       &lt;VRTRasterBand dataType=&quot;Byte&quot; band=&quot;1&quot;&gt;<br>
&gt;         &lt;ColorInterp&gt;Gray&lt;/ColorInterp&gt;<br>
&gt;         &lt;SimpleSource&gt;<br>
&gt;           &lt;SourceFilename relativeToVRT=&quot;1&quot;&gt;a1.tif&lt;/SourceFilename&gt;<br>
&gt;           &lt;SourceBand&gt;1&lt;/SourceBand&gt;<br>
&gt;           &lt;SrcRect xOff=&quot;0&quot; yOff=&quot;0&quot; xSize=&quot;100&quot; ySize=&quot;100&quot;/&gt;<br>
&gt;           &lt;DstRect xOff=&quot;0&quot; yOff=&quot;0&quot; xSize=&quot;100&quot; ySize=&quot;100&quot;/&gt;<br>
&gt;       &lt;HideNoDataValue&gt;1&lt;/HideNoDataValue&gt;<br>
&gt;       &lt;NoDataValue&gt;0&lt;/NoDataValue&gt;<br>
&gt;         &lt;/SimpleSource&gt;<br>
&gt;         &lt;SimpleSource&gt;<br>
&gt;           &lt;SourceFilename relativeToVRT=&quot;1&quot;&gt;a2.tif&lt;/SourceFilename&gt;<br>
&gt;           &lt;SourceBand&gt;1&lt;/SourceBand&gt;<br>
&gt;           &lt;SrcRect xOff=&quot;0&quot; yOff=&quot;0&quot; xSize=&quot;100&quot; ySize=&quot;100&quot;/&gt;<br>
&gt;           &lt;DstRect xOff=&quot;0&quot; yOff=&quot;0&quot; xSize=&quot;100&quot; ySize=&quot;100&quot;/&gt;<br>
&gt;       &lt;HideNoDataValue&gt;1&lt;/HideNoDataValue&gt;<br>
&gt;       &lt;NoDataValue&gt;0&lt;/NoDataValue&gt;<br>
&gt;         &lt;/SimpleSource&gt;<br>
&gt;       &lt;/VRTRasterBand&gt;<br>
&gt;     &lt;/VRTDataset&gt;<br>
&gt; and I run the command:<br>
&gt;<br>
&gt;     gdal_translate mosaic.vrt mosaic.tif<br>
&gt;<br>
&gt; The result is identical to image `a2.tif`, instead of being a combination<br>
&gt; of `a1.tif` and `a2.tif`<br>
&gt;<br>
&gt; I got the error using gdal 1.8 and 1.9<br>
&gt;<br>
&gt; any ideas?<br>
&gt;<br>
<br>
<br>
</blockquote></div>