<p>Thanks! it works</p>
<p>a follow up "bonus" 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 "GDAL Warp API Tutorial" page <a href="http://www.gdal.org/warptut.html">http://www.gdal.org/warptut.html</a></p>
<p>and adding:<br>
psWarpOptions->padfSrcNoDataReal = new double(0);<br>
</p>
<div class="gmail_quote">On Feb 29, 2012 11:03 AM, "Even Rouault" <<a href="mailto:even.rouault@mines-paris.org">even.rouault@mines-paris.org</a>> 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 <<a href="mailto:ophiry@gmail.com">ophiry@gmail.com</a>>:<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>
<NODATA>0</NODATA> element in it. (well basically rename your current<br>
NoDataValue to NODATA.<br>
<br>
<br>
> I'm trying to build a mosaic, and I rely on the NoDataValue feature to<br>
> treat some parts of the image as transparent.<br>
> However, it appears that GDAL doesn't work as expected.<br>
><br>
> I also created a very simple test case using a vrt dataset and<br>
> gdal_translate - and I get the same results (that is - the 2nd image draws<br>
> over the 1st image, ignoring "transparent areas")<br>
><br>
> I have to 100X100 image files with a white marking (different in each file)<br>
> over black background (black being exactly equal to 0)<br>
> I built a simple vrt file:<br>
><br>
> <VRTDataset rasterXSize="100" rasterYSize="100"><br>
> <VRTRasterBand dataType="Byte" band="1"><br>
> <ColorInterp>Gray</ColorInterp><br>
> <SimpleSource><br>
> <SourceFilename relativeToVRT="1">a1.tif</SourceFilename><br>
> <SourceBand>1</SourceBand><br>
> <SrcRect xOff="0" yOff="0" xSize="100" ySize="100"/><br>
> <DstRect xOff="0" yOff="0" xSize="100" ySize="100"/><br>
> <HideNoDataValue>1</HideNoDataValue><br>
> <NoDataValue>0</NoDataValue><br>
> </SimpleSource><br>
> <SimpleSource><br>
> <SourceFilename relativeToVRT="1">a2.tif</SourceFilename><br>
> <SourceBand>1</SourceBand><br>
> <SrcRect xOff="0" yOff="0" xSize="100" ySize="100"/><br>
> <DstRect xOff="0" yOff="0" xSize="100" ySize="100"/><br>
> <HideNoDataValue>1</HideNoDataValue><br>
> <NoDataValue>0</NoDataValue><br>
> </SimpleSource><br>
> </VRTRasterBand><br>
> </VRTDataset><br>
> and I run the command:<br>
><br>
> gdal_translate mosaic.vrt mosaic.tif<br>
><br>
> The result is identical to image `a2.tif`, instead of being a combination<br>
> of `a1.tif` and `a2.tif`<br>
><br>
> I got the error using gdal 1.8 and 1.9<br>
><br>
> any ideas?<br>
><br>
<br>
<br>
</blockquote></div>