[R-sig-Geo] where is my raster stack? filename="" and inMemory=FALSE

Benjamin Leutner benj@min@leutner @ending from uni-wuerzburg@de
Thu Oct 25 13:00:20 CEST 2018


For a RasterStack the internal organisation is a list of RasterLayers.
Hence you can retrieve the filenames like this, for example:

sapply(1:nlayers(raster), function(f) filename(raster[[f]]))


On 10/25/18 12:36 PM, Hugo Costa wrote:
> Dear list,
>
> I imported a raster stack and made some processing (crop, reclassify). I
> can plot the stack and all looks fine. However, I don't know any more where
> the file is. Namely
>
> fromDisk(raster) retrieves FALSE
> filename(raster) retrieves ""
> inMemory(raster) retrieves FALSE
> hasValues(raster) retrieves TRUE
>
> printing out the raster gives me this:
> class       : RasterStack
> dimensions  : 7041, 7221, 50843061, 11  (nrow, ncol, ncell, nlayers)
> resolution  : 0.00015, 0.00015  (x, y)
> extent      : -10.04175, -8.9586, 37.972, 39.02815  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
> +towgs84=0,0,0
> names       : X10, X20, X30, X40, X50, X60, X70, X80, X90, X100, layer
> min values  :   0,   0,   0,   0,   0,   0,   0,   0,   0,    0,     0
> max values  :   1,   1,   1,   1,   0,   1,   0,   1,   1,    0,     1
>
> I want to do everything in memory, but now I need to use gdalwarp, and
> don't know how to define the argument srcfile. I can write my stack to
> somewhere using writeRaster and get a filename, but that is too slow for my
> needs and I'm looking for an alternative.
>
> Thank you
> Hugo
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Benjamin Leutner

Department of Remote Sensing
University of Würzburg



More information about the R-sig-Geo mailing list