[gdal-dev] Apply filter on VRT

Chaitanya kumar CH chaitanya.ch at gmail.com
Sat Apr 14 01:43:56 EDT 2012


Saâd,

I too got errors.
The only way to avoid them for now it to run the individual rasters through
their own filter vrt files.

I am going to dig deeper in the ticket #4616.
http://trac.osgeo.org/gdal/ticket/4616

On Fri, Apr 13, 2012 at 5:39 PM, Saâd HESSANE <saad.hessane at gmail.com>wrote:

> Hy list,
>
> Has anyone reproduce the bug?
>
> Thank you.
>
>
>
>
> 2012/4/12 Saâd HESSANE <saad.hessane at gmail.com>
>
>> Yes of course :
>>
>>>  <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 really simple to reproduce the problem : do a "buildvrt" on a set of
>> raster ( > 1 raster ). Edit the vrt file and rename "ComplexSource" tag
>> with "KernelFilteredSource". add if you want the kernel definition.
>> Now you can do a gdal_translate to write a tiff file.
>>
>> There's no error in the terminale.
>> gdal_translate crash and a windows error dialog appears saying that the
>> the program has encountered an error and have to be close (the error is in
>> frensh sorry for my bad english...).
>> I'm using gdal 1.9 x64 onto Win 7 x64.
>>
>>
>>
>> 2012/4/12 Chaitanya kumar CH <chaitanya.ch at gmail.com>
>>
>>> Saâd,
>>>
>>> Can you provide the vrt file causing the crash? Also, please show me the
>>> error messages you got.
>>>
>>>
>>> On Thu, Apr 12, 2012 at 7:21 PM, Saâd HESSANE <saad.hessane at gmail.com>wrote:
>>>
>>>> Thank you Chaitanya for the answer,
>>>>
>>>> I do the test with the kenel element like the documentation :
>>>>
>>>>
>>>>> <Kernel normalized="1">
>>>>>     <Size>3</Size>
>>>>>     <Coefs>0.11111111 0.11111111 0.11111111 0.11111111 0.11111111
>>>>> 0.11111111 0.11111111 0.11111111 0.11111111</Coefs>
>>>>> </Kernel>
>>>>>
>>>> It's the same probleme, gdal_translate crash. But if the VRTRasterBand
>>>> have just one KernelFilteredSource element, gdal_translate work fine and
>>>> apply the filtre correctely.
>>>>
>>>> The poblem appears if there are more than one KernelFilteredSource
>>>> element in the VRTRasterBand.
>>>>
>>>>
>>>>
>>>> 2012/4/12 Chaitanya kumar CH <chaitanya.ch at gmail.com>
>>>>
>>>>> Saâd,
>>>>>
>>>>> There should be a Kernel element in a KernelFilteredSource.
>>>>> FYI, all the pixels whose kernel has a nodata pixel will be reported
>>>>> as a nodata pixel.
>>>>>
>>>>>  On Wed, Apr 11, 2012 at 3:20 PM, Saâd HESSANE <saad.hessane at gmail.com
>>>>> > wrote:
>>>>>
>>>>>>  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 !
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> gdal-dev mailing list
>>>>>> gdal-dev at lists.osgeo.org
>>>>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best regards,
>>>>> Chaitanya kumar CH.
>>>>>
>>>>> +91-9494447584
>>>>> 17.2416N 80.1426E
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Chaitanya kumar CH.
>>>
>>> +91-9494447584
>>> 17.2416N 80.1426E
>>>
>>
>>
>


-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120414/2bfa0c50/attachment-0001.html


More information about the gdal-dev mailing list