[gdal-dev] Reading ArcInfo binary grids with the R rgdalpackage fails with "GDAL Error 3: Attempt to read past EOF in..../arc.dir"

Gregory, Matthew matt.gregory at oregonstate.edu
Wed Jul 22 14:17:43 EDT 2009


Hi Even,

Even Rouault wrote:
> I've pushed in trunk (r17430) and branches/1.6 (r17431) a 
> workaround to enable users to open those datasets that 
> trigger the error with binding languages. 
> As Open() in swig/include/gdal.i checks that there is no 
> failure returned by
> CPLGetLastErrorType() even if the dataset is not NULL, the 
> workaround is just to reset the error state before returning 
> the dataset.

Thanks much, Even.  I've tested at r17432 and it seems to work for
Python:

  >>> from osgeo import gdal
  >>> ds = gdal.Open('D:/matt/vat_test/grid1')
  >>> type(ds)
  <class 'osgeo.gdal.Dataset'>
  >>> rb = ds.GetRasterBand(1)
  >>> rat = rb.GetDefaultRAT()
  ERROR 3: Attempt to read past EOF in 
  D:/matt/vat_test/grid1/../info/../grid1/vat.adf.
  >>> rat.GetRowCount()
  1280
  >>> rat.GetColumnCount()
  2
  >>> rat.GetValueAsInt(4, 1)
  72134

By the way, having RAT (VAT) support for AIG datasets is just great.
Thanks so much for implementing the initial fix.
 
> For people affected by the issue, not being able to build 
> GDAL from source and not interested in the raster attribute 
> table, they can just rename the 'info' 
> directory, so it won't be read at all and won't trigger the error.
> 
> See http://trac.osgeo.org/gdal/ticket/3031

Um, this makes me really nervous to advocate renaming the INFO
directory, but maybe I'm overreacting.  I think your recent fix of not
calling ReadRAT() in AIGDataset::Open() eliminates this workaround,
correct?  Just as long as the user doesn't call GetDefaultRAT()?

matt


More information about the gdal-dev mailing list