[gdal-dev] Transparency using gdalbuildvrt
Brent Fraser
bfraser at geoanalytic.com
Fri Mar 13 14:47:30 EDT 2009
Jason,
I'm doing some similar things with vrt and DEMs. I can't comment about the alpha/RGBA thing but I was able to get the no-data setting used for the source data by editing the vrt file.
gdalbuildvrt creates a "SimpleSource" type of VRT:
-----------------
<VRTDataset rasterXSize="3601" rasterYSize="3601">
<VRTRasterBand dataType="Int16" band="1">
<NoDataValue>-3.27670000000000E+004</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">082\082a13_0102_deme.dem</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="1201" RasterYSize="1201" DataType="Int16" BlockXSize="1201" BlockYSize="1201"/>
<SrcRect xOff="0" yOff="0" xSize="1201" ySize="1201"/>
<DstRect xOff="2400" yOff="2400" xSize="1201" ySize="1201"/>
</SimpleSource>
:
-----------------
I edited the VRT to be a "ComplexSource" type, and added a <NODATA> tag for each source entry:
-----------------
<VRTDataset rasterXSize="3601" rasterYSize="3601">
<VRTRasterBand dataType="Int16" band="1">
<NoDataValue>-3.27670000000000E+004</NoDataValue>
<ComplexSource>
<SourceFilename relativeToVRT="0">082\082a13_0102_deme.dem</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="1201" RasterYSize="1201" DataType="Int16" BlockXSize="1201" BlockYSize="1201"/>
<SrcRect xOff="0" yOff="0" xSize="1201" ySize="1201"/>
<DstRect xOff="2400" yOff="2400" xSize="1201" ySize="1201"/>
<NODATA>-32767</NODATA>
</ComplexSource>
:
-----------------
Best Regards,
Brent Fraser
Jason Beverage wrote:
> Hi all,
>
> I've been playing around with gdalbuildvrt lately and it has proven to
> be a very useful tool:)
>
> What I'm attempting to do is take multiple RGB images and treat them as
> a single image using the VRT. This works great, but since the images
> are RGB, areas where there is no data are coming back as black. Is
> there a way that I can modify the VRT or the code to treat the VRT as an
> RGBA dataset and somehow say "If there is no data in any bands, the
> alpha is 0"?
>
> Thanks!
>
> Jason
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list