[gdal-dev] Apply filter on VRT

Saâd HESSANE saad.hessane at gmail.com
Wed Apr 11 05:50:54 EDT 2012


Hy all,

I have a VRT file generated with buildvrt utility :

<VRTDataset rasterXSize="52436" rasterYSize="32400">
>   <SRS>...</SRS>
>   <GeoTransform>...</GeoTransform>
>   <VRTRasterBand dataType="UInt16" band="1">
>     <NoDataValue>0</NoDataValue>
>     <ColorInterp>Gray</ColorInterp>
>     <ComplexSource>
>       <SourceFilename relativeToVRT="1">1.tif</SourceFilename>
>       <SourceBand>1</SourceBand>
>       <SourceProperties RasterXSize="8449" RasterYSize="6429"
> DataType="UInt16" BlockXSize="8449" BlockYSize="1" />
>       <SrcRect xOff="0" yOff="0" xSize="8449" ySize="6429" />
>       <DstRect xOff="0" yOff="0" xSize="10721" ySize="8158" />
>       <NODATA>0</NODATA>
>     </ComplexSource>
>     <ComplexSource>
>       <SourceFilename relativeToVRT="1">2.tif</SourceFilename>
>       <SourceBand>1</SourceBand>
>       <SourceProperties RasterXSize="8772" RasterYSize="6407"
> DataType="UInt16" BlockXSize="8772" BlockYSize="1" />
>       <SrcRect xOff="0" yOff="0" xSize="8772" ySize="6407" />
>       <DstRect xOff="43664" yOff="25993" xSize="8772" ySize="6407" />
>       <NODATA>0</NODATA>
>     </ComplexSource>
>   </VRTRasterBand>
> </VRTDataset>
>

It's work fine with a gdal_translate.
Now I want to apply a filter kernel to the VRT. I have to use the
KernelFilteredSource.
The gdal api say that VRTKernelFilteredSource is a sub-class of
VRTComplexSource. So a VRTKernelFilteredSource *is *a VRTComplexSource.
But if I replace VRTComplexSource by VRTKernelFilteredSource,
gdal_translate crash. This is the new VRT :

<VRTDataset rasterXSize="52436" rasterYSize="32400">
>   <SRS>...</SRS>
>   <GeoTransform>...</GeoTransform>
>   <VRTRasterBand dataType="UInt16" band="1">
>     <NoDataValue>0</NoDataValue>
>     <ColorInterp>Gray</ColorInterp>
>     <KernelFilteredSource>
>       <SourceFilename relativeToVRT="1">1.tif</SourceFilename>
>       <SourceBand>1</SourceBand>
>       <SourceProperties RasterXSize="8449" RasterYSize="6429"
> DataType="UInt16" BlockXSize="8449" BlockYSize="1" />
>       <SrcRect xOff="0" yOff="0" xSize="8449" ySize="6429" />
>       <DstRect xOff="0" yOff="0" xSize="10721" ySize="8158" />
>       <NODATA>0</NODATA>
>     </KernelFilteredSource>
>     <KernelFilteredSource>
>       <SourceFilename relativeToVRT="1">2.tif</SourceFilename>
>       <SourceBand>1</SourceBand>
>       <SourceProperties RasterXSize="8772" RasterYSize="6407"
> DataType="UInt16" BlockXSize="8772" BlockYSize="1" />
>       <SrcRect xOff="0" yOff="0" xSize="8772" ySize="6407" />
>       <DstRect xOff="43664" yOff="25993" xSize="8772" ySize="6407" />
>       <NODATA>0</NODATA>
>     </KernelFilteredSource>
>   </VRTRasterBand>
> </VRTDataset>
>

It's weird, I expected a polymorphism between VRTComplexSource and
VRTKernelFilteredSource.
So the question : how can I apply a filter to a VRT?
Thank you !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120411/721a6940/attachment.html


More information about the gdal-dev mailing list