[gdal-dev] Reading ArcInfo binary grids with the R rgdal package
fails with "GDAL Error 3: Attempt to read past EOF in ..../arc.dir"
Jason Roberts
jason.roberts at duke.edu
Tue Jul 21 20:57:35 EDT 2009
I have some R code that reads ArcInfo binary grids using the rgdal package.
This code has worked for a long time. Now, with the latest versions of
everything it is failing with the message:
GDAL Error 3: Attempt to read past EOF in
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0/../info/arc.dir.
A transcript of the R session appears below, showing the version numbers of
everything. The grids were generated by ArcGIS 9.3.1. I have not tried with
other versions of ArcGIS (I suspect that ESRI hasn't changed this code in a
while).
Note that there are several grids stored in the directory and rgdal can read
some of them but not others. The first one that failed, projected0, can be
read by gdalinfo 1.6.0. I do not have gdalinfo 1.6.1 because I could not
locate prebuilt Windows binaries for it. If somebody has them, I can try
again with 1.6.1.
Because my code has worked for a long time and I haven't changed it, I
suspect a bug in either rgdal or gdal itself. Can you advise me on how to
follow up with this?
I can provide a zipped copy of the directory containing the rasters
(probably 1 MB zipped).
Thanks,
Jason
Here is the R transcript:
R version 2.9.1 (2009-06-26)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
also installing the dependency 'sp'
trying URL
'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.9/sp_0.9-43.zip'
Content type 'application/zip' length 869722 bytes (849 Kb)
opened URL
downloaded 849 Kb
trying URL
'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.9/rgdal_0.6-10.zip'
Content type 'application/zip' length 7767149 bytes (7.4 Mb)
opened URL
downloaded 7.4 Mb
package 'sp' successfully unpacked and MD5 sums checked
package 'rgdal' successfully unpacked and MD5 sums checked
The downloaded packages are in
C:\Users\Jason\AppData\Local\Temp\RtmpbhzZ6p\downloaded_packages
updating HTML package descriptions
> library(rgdal)
Loading required package: sp
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.6.1, released 2009/05/11
Path to GDAL shared files: C:/PROGRA~1/R/R-29~1.1/library/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.6.1, 21 August 2008
Path to PROJ.4 shared files: C:/PROGRA~1/R/R-29~1.1/library/rgdal/proj
> rasterInfo <-
open.SpatialGDAL("C:\\Temp\\GeoEcoTemp_Jason\\tmphrgwuo\\projected0")
Error in .local(.Object, ...) :
GDAL Error 3: Attempt to read past EOF in
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0/../info/arc.dir.
> traceback()
7: .Call("RGDAL_OpenDataset", as.character(filename), TRUE, PACKAGE =
"rgdal")
6: .local(.Object, ...)
5: initialize(value, ...)
4: initialize(value, ...)
3: new("GDALReadOnlyDataset", filename)
2: GDAL.open(con, read.only = TRUE)
1: open.SpatialGDAL("C:\\Temp\\GeoEcoTemp_Jason\\tmphrgwuo\\projected0")
> rasterInfo <-
open.SpatialGDAL("C:\\Temp\\GeoEcoTemp_Jason\\tmphrgwuo\\projected0a")
Error in .local(.Object, ...) :
GDAL Error 3: Attempt to read past EOF in
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0a/../info/arc.dir.
> rasterInfo <-
open.SpatialGDAL("C:\\Temp\\GeoEcoTemp_Jason\\tmphrgwuo\\projected2")
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected2 has GDAL driver AIG
and has 157 rows and 96 columns
> rasterInfo <-
open.SpatialGDAL("C:\\Temp\\GeoEcoTemp_Jason\\tmphrgwuo\\projected2a")
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected2a has GDAL driver AIG
and has 156 rows and 96 columns
> rasterInfo <-
open.SpatialGDAL("C:\\Temp\\GeoEcoTemp_Jason\\tmphrgwuo\\clipped1")
Error in .local(.Object, ...) :
GDAL Error 3: Attempt to read past EOF in
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\clipped1/../info/arc.dir.
> rasterInfo <-
open.SpatialGDAL("C:\\Temp\\GeoEcoTemp_Jason\\tmphrgwuo\\clipped1a")
Error in .local(.Object, ...) :
GDAL Error 3: Attempt to read past EOF in
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\clipped1a/../info/arc.dir.
>
But gdalinfo 1.6.0 can successfully open projected0:
Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\Jason>C:\Temp2\gdalwin32-1.6\bin\gdalinfo
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0
Driver: AIG/Arc/Info Binary Grid
Files: C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0.aux
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0\dblbnd.adf
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0\hdr.adf
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0\metadata.xml
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0\prj.adf
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0\sta.adf
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0\w001001.adf
C:\Temp\GeoEcoTemp_Jason\tmphrgwuo\projected0\w001001x.adf
Size is 96, 157
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AUTHORITY["EPSG","4326"]]
Origin = (-81.000000000000000,39.000000000000028)
Pixel Size = (0.083333333333333,-0.083333333333333)
Corner Coordinates:
Upper Left ( -81.0000000, 39.0000000)
Lower Left ( -81.0000000, 25.9166667)
Upper Right ( -73.0000000, 39.0000000)
Lower Right ( -73.0000000, 25.9166667)
Center ( -77.0000000, 32.4583333)
Band 1 Block=256x4 Type=Float32, ColorInterp=Undefined
Min=6.375 Max=34.800
NoData Value=-3.4028234663852886e+038
Metadata:
LAYER_TYPE=athematic
C:\Users\Jason>C:\Temp2\gdalwin32-1.6\bin\gdalinfo --version
GDAL 1.6.0, released 2008/12/04
C:\Users\Jason>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090721/5d265246/attachment-0001.html
More information about the gdal-dev
mailing list