[Gdal-dev] Re: Question of GDAL Virtual Format
Frank Warmerdam
warmerdam at pobox.com
Wed Aug 20 12:36:09 EDT 2003
Feng Wang wrote:
> Hi, Frank:
>
> Now we have a need to display combined image with three image files as
> red, green and blue bands.
> To do this, we want to use GDAL virtual format to simplify programming.
> After I read the tutorial,
> I have some questions for your help.
>
> Can we use multi <SimpleSource> </SimpleSource> to made a virtual
> dataset like this:
>
> <VRTDataset rasterXSize="512" rasterYSize="512">
> <VRTRasterBand dataType="Byte" band="3">
> <ColorInterp>RGB</ColorInterp>
>
> <SimpleSource>
> <SourceFilename>Filename1.tif</SourceFilename>
> <SourceBand>1</SourceBand>
> <SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
> <DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
> </SimpleSource>
>
> <SimpleSource>
> <SourceFilename>Filename2.tif</SourceFilename>
> <SourceBand>1</SourceBand>
> <SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
> <DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
> </SimpleSource>
>
> <SimpleSource>
> <SourceFilename>Filename3.tif</SourceFilename>
> <SourceBand>1</SourceBand>
> <SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
> <DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
> </SimpleSource>
> </VRTRasterBand>
> </VRTDataset>
Feng,
Not quite. You need 3 VRTRasterBand objects each with a single source.
The SrcRect and DstRect elements may be omitted when the default 1:1 mapping
is being used. So, a VRT file for composing 3 bands might look like the
following ... this examples also includes setting the color interpretation
properly though this wouldn't normally matter in RationalMapper.
<VRTDataset rasterXSize="256" rasterYSize="200">
<VRTRasterBand dataType="Byte" band="1">
<ColorInterp>Red</ColorInterp>
<SimpleSource>
<SourceFilename>red.tif</SourceFilename>
<SourceBand>1</SourceBand>
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="2">
<ColorInterp>Green</ColorInterp>
<SimpleSource>
<SourceFilename>green.tif</SourceFilename>
<SourceBand>1</SourceBand>
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="3">
<ColorInterp>Blue</ColorInterp>
<SimpleSource>
<SourceFilename>blue.tif</SourceFilename>
<SourceBand>1</SourceBand>
</SimpleSource>
</VRTRasterBand>
</VRTDataset>
I have taken the liberty of cc:ing the GDAL list since this may be of
interest to others.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list