[R-sig-Geo] Raster data (.adf) problem with rgdal

Roger Bivand Roger.Bivand at nhh.no
Thu Jul 2 11:51:10 CEST 2009


On Wed, 1 Jul 2009, Jennifer Burney wrote:

> Hi all,
>
> I am trying to read some ArcView raster data into R (data located at:
> http://www.sage.wisc.edu/atlas/data.php?incdataset=Suitability%20for%20Agriculture
> ).
>
> I have had the experience mentioned by others in previous posts, where
> RArcInfo crashes and can't seem to handle this file (although it isn't very
> big), so I've been attempting to follow the advice posted here and use
> rgdal. Unfortunately, I don't get very far:

RArcInfo is only for vector coverages, not for grids - it would be the 
same as readOGR().

>
> p="/Users/jab/Desktop/suit/suit/hdr.adf"
> x=new("GDALReadOnlyDataset",p)
>
> returns: Error in .local(.Object, ...) :
>  GDAL Error 3: Attempt to read past EOF in
> /Users/jab/Desktop/suit/suit/../info/arc.dir.
>

Reproduced.

> Thoughts?

Broken file? The GDAL drivers can only handle some implementation 
oddities. After going to GTiff, the data can be retrieved. If you have 
gdal_transform on your PATH, this works:

system("gdal_translate -of 'GTiff' suit/hdr.adf suit.tif")

with error messages, and:

> zz <- readGDAL("suit.tif")
suit.tif has GDAL driver GTiff
and has 360 rows and 720 columns
> summary(zz)
Object of class SpatialGridDataFrame
Coordinates:
    min max
x -180 180
y  -90  90
Is projected: NA
proj4string : [NA]
Number of points: 2
Grid attributes:
   cellcentre.offset cellsize cells.dim
x           -179.75      0.5       720
y            -89.75      0.5       360
Data attributes:
  Min.  1st Qu.   Median     Mean  3rd Qu.     Max.       NA's
0.000    0.004    0.046    0.224    0.397    0.999 200280.000
> image(zz)

looks plausible.

Hope this helps,

Roger

PS. Maybe let the data provider know that GTiff is a more suitable 
format, and the zipped file is only one third of the size of the zipped 
AI binary grid.

>
> Thanks in advance,
> Jen
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list