[R-sig-Geo] writeRaster give error "no slot of name "file" for this object..."

newmat mattias at norrasverige.se
Tue Jun 7 18:56:39 CEST 2011


I'm using the raster-package in R. I have problem writing an RasterStack to a
multi-band tif-file. I provide an example code below that is
self-explaining. I receive the following error on the last row, using
writeRaster:
Error in attr(x at file, "transient") <- temp[[1]] : 
  no slot of name "file" for this object of class "RasterStack"

Can it be because my rasterLayers and rasterStack are "inMemory"?

rExtent <- extent(664300,665800,7585000,7586400)
rasterTemplate <- raster(rExtent, 140, 150, crs=NA) rLayers <- list() for(i
in 1:64) { rLayers[[i]] <- raster(rasterTemplate)
values(rLayers[[i]]) <- runif(ncell(rasterTemplate), min=0, max=10) }

rStack <- stack(rLayers)

writeRaster(rStack, "test.tif", overwrite=TRUE)


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-give-error-no-slot-of-name-file-for-this-object-tp6450479p6450479.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list