[gdal-dev] Is it possible to change block size of a VRT file ?

Even Rouault even.rouault at mines-paris.org
Thu Jan 29 14:27:08 EST 2009


Hi Guillaume,

This is a good point and I've also experienced suboptimal performance because 
of this. The answer is : no, you can't change the block size of a 
VRTSourcedRasterBand in a VRTDataset. But this can be currently done for a 
VRTWarpedDataset.

Clearly for a scanline oriented underlying raster with big width, a 128x128 
tiling will not be ideal for performance.

The main issue is that it is not easy in the general case to determine the 
optimal block size as you can add in a VRT several underlying raster datasets 
that have different block size.

But in some scenarios, you just reference one single raster into a 
VRT. 'gdal_translate -of VRT -expand rgb' comes to my mind, but any 
gdal_translate command that uses a VRT dataset as a temporary source dataset 
(because of quite a few options, like -a_srs, -a_ullr, etc etc) before 
translation to the final format might also been affected.

In your scenario of a VRT file made of 2 tif files that have a block size of 
1000x1, it might also  be interesting to be able to specify the block 
dimensions so that nBlockYSize == 1.

This would be feasible by moving code from VRTWarpedDataset to its base class 
VRTDataset. The 2 elements already exist <BlockXSize> and <BlockYSize>
They would be used if found, otherwise the default would be used. 

As for setting those values is concerned, I can imagine a 
VRTDatasetSetBlockSize() method that should be called before the first band 
is added to the dataset. This would be used by gdal_translate, or by any code 
that has some clues on a better block size than the default when building a 
VRT.

It might be interesting that you create a trac ticket for that enhancement 
request.

Even.

PS: The block size is actually determined by the following formula :
    nBlockXSize = MIN(128,nXSize);
    nBlockYSize = MIN(128,nYSize);
where nXSize, nYSize are the raster dimensions


Le Thursday 29 January 2009 10:54:21 guillaume huby, vous avez écrit :
> Hi everyone,
>
> I'm using GDAL 1.6.0. I observed that by default, VRT Block size is
> 128x128, whatever the inputs datas block size is.
> Is it possible to change block size of a VRT file ? And how ?
>
> For exemple, if my VRT file is made of 2 tif files that have a block size
> of 1000x1. The VRT file have a block size of 128x128. Do this different
> block size have an impact on the performance of processings (warping the
> VRT file for exemple) ? I would have think that a block size of 1000x1 for
> the VRT file would have improved the performance of the process, but maybe
> I'm wrong.
>
> Thank you for your replies !
>
> Regards,
> Guillaume.




More information about the gdal-dev mailing list