Trip rasterize.

Arguments

x

trip object

y

Raster* object

field

attribute from which differences will be calculated, defaults to the time-stamp between trip locations

Value

RasterLayer

Examples

d <- data.frame(x=1:10, y=rnorm(10), tms=Sys.time() + 1:10, id=gl(2, 5)) sp::coordinates(d) <- ~x+y ## this avoids complaints later, but these are not real track data (!) sp::proj4string(d) <- sp::CRS("+proj=laea +ellps=sphere", doCheckCRSArgs = FALSE) tr <- trip(d, c("tms", "id")) tr$temp <- sort(runif(nrow(tr))) r <- rasterize(tr) rasterize(tr, grid = r)
#> class : RasterLayer #> dimensions : 100, 100, 10000 (nrow, ncol, ncell) #> resolution : 0.09090909, 0.02793937 (x, y) #> extent : 0.9545455, 10.04545, -1.863474, 0.9304629 (xmin, xmax, ymin, ymax) #> crs : +proj=laea +ellps=sphere #> source : memory #> names : layer #> values : 0, 0.04400829 (min, max) #>
rasterize(tr, r, field = "temp")
#> class : RasterLayer #> dimensions : 100, 100, 10000 (nrow, ncol, ncell) #> resolution : 0.09090909, 0.02793937 (x, y) #> extent : 0.9545455, 10.04545, -1.863474, 0.9304629 (xmin, xmax, ymin, ymax) #> crs : +proj=laea +ellps=sphere #> source : memory #> names : layer #> values : 0.007792683, 0.2859739 (min, max) #>
if (FALSE) { rasterize(tr, method = "density") rasterize(tr, method = "density", grid = r) rasterize(tr, r, field = "tms") rasterize(tr, r) library(raster) r2 <- aggregate(r, fact = 4) rasterize(tr, grid = r2) rasterize(tr, method = "density") rasterize(tr, method = "density", grid = r2) rasterize(tr, r2, field = "temp") rasterize(tr, r2, field = "tms") rasterize(tr, r2) }