[gdal-dev] Overriding IRasterIO in class derived from GDALRasterBand

Jorge Arévalo jorge.arevalo at gmail.com
Fri Aug 7 11:05:54 EDT 2009


Hello,

Context: GDAL WKT Raster driver

In my class derived from GDALRasterBand, I've overrided the methods:

- IReadBlock: Fetch a block from database
- IRasterIO: Should fetch several blocks, that cover an area, and add
them to papoBlocks (cache). The idea is to avoid rounds in the server

AFAIK, the base IRasterIO implementation (in GDALRasterBand), tries to
fetch the block from the cache. If the block isn't in the cache, then
call to IReadBlock. So, the normal way to read blocks in any GDAL
driver should be IRasterIO --> IReadBlock

Then, If I override IRasterIO in my driver RasterBand's class, I
should fetch several blocks in one round and call GetLockedBlockRef to
add these blocks to the cache. After this, call the base
implementation of IRasterIO (in GDALRasterBand) to do its work (see
previous point).

Is it correct? I have problems with my IRasterIO implementation,
because it takes a long time executing until this fail:

ERROR 7: Assertion `nLockCount == 0' failed
in file `gdalrasterblock.cpp', line 228

Is there any mistake in this approach? If not, I suppose I had to
debug my queries, but I'd like to rule our wrong concepts first.

Many thanks in advance.

Best regards,
Jorge


More information about the gdal-dev mailing list