G'day Everyone,

I have recently been trying to run some analysis on very large raster files (~200mb, file found here<https://www.ga.gov.au/products/servlet/controller?event=FILE_SELECTION&catno=71071> the first option "Tagged Image File Format (TIFF), Contains the final 34 DLC classes, 25.77MB") for Australian land cover. I can successfully read this file into R and isolate the information I am interested in, eg.,

# to get a tree cover map, where tree cover is 1 and everything else is 0
library(raster)
                                landcover<-raster("landcover_file.tiff") # I can only open the large TIFF file as a raster?
isBecomes< -cbind(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34),c(NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,NA,NA))
treecover <- reclass(landcover, rcl=isBecomes)

I would then like to get some distance data from this treecover map using gdistance. I try to create a transition matrix from the treecover raster (which will be incredibly huge) and get the Error: can not allocate vector of size ... .

                                library(gdistance)
tr1 <- transition(r, transitionFunction=mean, directions=8)

Error: cannot allocate vector of size 1.1 Gb
In addition: Warning messages:
1: In `slot<-`(.Object, slotName, check = FALSE, slotVal) :
  Reached total allocation of 3892Mb: see help(memory.size)
2: In `slot<-`(.Object, slotName, check = FALSE, slotVal) :
  Reached total allocation of 3892Mb: see help(memory.size)
3: In `slot<-`(.Object, slotName, check = FALSE, slotVal) :
  Reached total allocation of 3892Mb: see help(memory.size)
4: In `slot<-`(.Object, slotName, check = FALSE, slotVal) :
  Reached total allocation of 3892Mb: see help(memory.size)

I am wondering what I could do to get around this? Is there a better way to work with such large files? I have been reading up on ff and bigmemory but am finding it hard to find a simple introduction that explains how to work with raster files in these frameworks. In other words, I sort of get what these packages are doing I just don't understand how to implement them. Does anyone have example code for importing a raster using ff and then working on it with some functions?

I am running 64bit R on a laptop with only 4GB RAM. The only other thing I can think of doing is using a machine with more RAM, unfortunately that's not really an option. Any suggestions or help would be great and really appreciated. Thanks in advance for your time and suggestions.


Kind regards,

Adam Cardilini
PhD Candidate
Schools of Life and Environmental Sciences,
Deakin University, 75 Pigdons Rd,
Waurn Ponds, Vic, Australia, 3217
Mob: 0431 566 340
Email: apcar@deakin.edu.au


	[[alternative HTML version deleted]]

