[R-sig-Geo] regularly subset (subsample) a raster and get a raster
loic.dutrieux at wur.nl
Wed Sep 3 14:39:20 CEST 2014
Aggregate sounds like a safe option (memory safe and you do not lose the
spatial information). Give it a try, it may not have such a big overhead.
r <- raster(system.file(package = 'raster', 'external/test.grd'))
fun <- function(x) x
r2 <- aggregate(r, by = 2, FUN = fun)
Laboratory of Geo-Information Sciences and Remote Sensing
On 03/09/2014 13:56, Jean-Luc Dupouey wrote:
> Dear forumites,
> Using R, I want to regularly subsample a raster (for example, one point
> over two), and get a raster.
> Usual R subsampling works with raster layers:
> but it only gives in return a vector of values, not a raster layer
> object. All the raster information is lost (spatial reference, etc.).
> How can I subsample my initial raster and still keep a raster?
> I thought of using "aggregate" or "crop" functions, but I am working on
> large datasets, and I would prefer to avoid any unnecessary calculations.
> Thank you in advance,
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
More information about the R-sig-Geo