[Gdal-dev] Bug in OGDI Driver when accessing tiles (FAILURE: 1: End of selection)

Reiner Beck r.beck at m4com.de
Tue Mar 28 09:03:10 EST 2006


(2nd try - the first one went to gdal-dev at remotesensing.org - sorry if 
you receive this twice)

Hello List,

there seems to be a bug in the OGDI driver when accessing tiles which 
are directly "under" the previously fetched tile.

Here's what I do:
- The driver is a RPF dataset and the sub-dataset used is a Matrix layer.
  This is a layer with a colortable, not the RGB Image layer.
- The error does only occur for single band access.
- I read the image data tile by tile using the 
GDALRasterBand::RasterIO() method.
- For example, the Image Size is 6144x3072, Tile Size is 256x256, No of 
Tiles is 24x12.
- For internal reasons, the tiles are fetched somewhat randomly.
- The error occurs only in case a tile is read, followed by a read to a 
tile which is directly
  under the previously read tile.

Example:
First tile to read is [3, 7]:

This results in calls to:
  poBand->RasterIO(GF_Read, 768, 1792, 256, 256, poinerToMyBuffer, 256, 
256, 1, 1, 256);

and GDAL internal to
  OGDIRasterBand::EstablishAccess(768, 1792, 256, 256, 256, 256);

Let's assume this works.


Next tile to read is [3, 8]:

This results in calls to:
  poBand->RasterIO(GF_Read, 768, 2048, 256, 256, poinerToMyBuffer, 256, 
256, 1, 1, 256)
and GDAL internal to
  OGDIRasterBand::EstablishAccess(768, 2048, 256, 256, 256, 256);

In this case, the method EstablishAccess() will not call 
cln_SelectRegion() and the read will fail with an error 1 "End of 
selection". This happens in the OGDI RPF driver, function 
dyn_getNextObjectRaster(). However, I think the error is in the GDAL part.


Workaround:
In case the if statement in EstablishAccess() is commented out (not the 
body of the statement), it works:
/*
/if( poODS->nCurrentIndex == -1 / / || ABS(sWin.west - 
poODS->sCurrentBounds.west) > 0.0001 / / || ABS(sWin.east - 
poODS->sCurrentBounds.east) > 0.0001 / / || ABS(sWin.north - 
(poODS->sCurrentBounds.north - poODS->nCurrentIndex * 
poODS->sCurrentBounds.ns_res)) > dfNSTolerance / / || 
ABS(sWin.ew_res/poODS->sCurrentBounds.ew_res - 1.0) > 0.0001/ / || 
ABS(sWin.ns_res - poODS->sCurrentBounds.ns_res) > dfNSTolerance )/ /
*/
Not sure if this is the best solution though ...


Version:
gdal 1.2.6 and ogdi 3.1.4. However, the affected code seems to be 
identical to the most recent versions (checked against gdal 1.3.1 and 
ogdi 3.1.5).

Cheers
Reiner





More information about the Gdal-dev mailing list