Crossing multiple raster to obtain a list of available values for each cell - LULCC package
Hello, I am unfamiliar with the LULCC package, but what you describe sounds to me like a simple extraction at one or more cell locations. At least, that is what I think you describe here...
That is, if I cross three rasters of one cell, with values 0, 1, 0, I would like to obtain a result that would tell me that the values of that cell are: 0, 1, 0.
I think that is a simple matter of raster::extract(). ### library(raster) nr <- 3 nc <- 4 ncell <- nr * nc m <- matrix(seq_len(ncell), nc = nc, nr = nr) one <- raster(m) two <- raster(m * 2) three <- raster(m * 3) S <- stack(one, two, three) extract(S, c(1, 3, ncell)) # layer.1 layer.2 layer.3 # [1,] 1 2 3 # [2,] 7 14 21 # [3,] 12 24 36 ### Have I understood the issue? Ben
On Fri, Nov 27, 2020 at 6:59 AM David Garc?a ?lvarez <dagaral at ugr.es> wrote:
Dear list, I want to cross multiple rasters with the same spatial resolution and extent and obtain as a result a summary raster or table that tells me which are the values that each cell acquires in the different rasters. That is, if I cross three rasters of one cell, with values 0, 1, 0, I would like to obtain a result that would tell me that the values of that cell are: 0, 1, 0. I have checked that the crosstab function of the raster packages allows to cross multiple rasters (by using a rasterstack). However, I do not know how to obtain the result I explained above. The LULCC package includes different functions to do that. However, in my experience, it is not really efficient and does not work well for rasters that are not very simple. The basic function of the package (Threemapcomparison) did not work for me or took for ages to run. Therefore, I would like to ask the community for help about: 1. ways to do the operation I described above, 2. to effectively work with the LULCC package in case I am doing something wrong or my issues with processing time / errors are not normal. Best, David
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Ben Tupper Bigelow Laboratory for Ocean Science East Boothbay, Maine http://www.bigelow.org/ https://eco.bigelow.org