[Gdal-dev] caching of the blocks

Frank Warmerdam warmerdam at pobox.com
Fri Aug 27 13:14:12 EDT 2004

Stephane Routelous wrote:
> Hi,
> I'm using GDALRasterBand::ReadBlock to access raster info; I cannot use
> RasterIO because I need to scale the values by myself.
> Is it true that the ReadBlock method does not put the blocks in cache ?
> I tried to follow the code to see what's happenning, and it seems so.
> Can you confirm that ?


I can confirm that.  ReadBlock() just does a wee bit of parameter checking
and then calls IReadBlock() at the driver specific level.  This reads into
the passed in data array but no where in this call chain is the existing
block cache used or populated.

The ReadBlock() method is essentially intended to be the most direct
way of getting data from a driver with no overhead from caching, resampling
or data type conversion.

In retrospect, I'm not sure I like this approach so well.  The fact that you
might already have the block in cache and that would be ignored is kind of
obtuse for instance.

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