[R-sig-Geo] Problem reading files through rgdal

Agustin Lobo alobolistas at gmail.com
Tue Dec 13 08:14:27 CET 2011


Hi!

I have this problem and think it's related to rgdal (or rather to gdal).

r <- raster(ncol=10, nrow=10)
r1 <- init(r, fun=runif)
r2 <- init(r, fun=runif)
r3 <- overlay(r1, r2, fun=function(x,y){return(x+y)})
> writeRaster(r3,filename="delme.tif",format="GTiff",overwrite=T,datatype="FLT4S")
Error in .local(.Object, ...) : Unable to create dataset
> sp2003 <- brick(paste(datawd,"/SPOTmultispectral/SP2003ATC_atm2.tif",sep=""))
Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) :
 Cannot create a RasterLayer object from this file.
> delme = readGDAL(paste(datawd,"/SPOTmultispectral/SP2003ATC_atm2.tif",sep=""))
Error in .local(.Object, ...) :

`/media/Iomega_HDD/MASTER_ICTA2007_2008/ExercisesJEMES/ExerciseFIRESPOT/Data_ExerciseFIRESPOT/SPOTmultispectral/SP2003ATC_atm2.tif'
not recognised as a supported file format.

> GDALinfo(paste(datawd,"/SPOTmultispectral/SP2003ATC_atm2.tif",sep=""))
Error in .local(.Object, ...) :

`/media/Iomega_HDD/MASTER_ICTA2007_2008/ExercisesJEMES/ExerciseFIRESPOT/Data_ExerciseFIRESPOT/SPOTmultispectral/SP2003ATC_atm2.tif'
not recognised as a supported file format.

I can read/write any external file not using rgdal, and save() and
save.image() work fine:
> save.image()
> x = data.frame(var1=1:10,var2=LETTERS[1:10])
> x
   var1 var2
1     1    A
2     2    B
3     3    C
4     4    D
5     5    E
6     6    F
7     7    G
8     8    H
9     9    I
10   10    J
> write.csv(x,file="x.csv")
> x2 <- read.csv("x.csv")
> x2
    X var1 var2
1   1    1    A
2   2    2    B
3   3    3    C
4   4    4    D
5   5    5    E
6   6    6    F
7   7    7    G
8   8    8    H
9   9    9    I
10 10   10    J

It seems to me a problem with gdal, my version is 1.8.0.2 from
ubuntugis-unstable binaries for ubuntu 10.04
Are you aware of any problem with gdal and/or rgdal?

Thanks,

Agus

> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C LC_TIME=en_US.UTF-8
 LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=C
              LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rgdal_0.7-5   raster_1.9-55 sp_0.9-89

loaded via a namespace (and not attached):
[1] grid_2.14.0     lattice_0.19-30 tools_2.14.0



More information about the R-sig-Geo mailing list