overlap | R Documentation |
Extract the union of overlapping terra SpatRasters with different extents, origins, and projections.
overlap(x, y, last = FALSE)
x, y |
SpatRaster. |
last |
Logical. Should only the last layer be returned? |
SpatRaster y will be transformed (e.g., projected, resampled) with respect to x if extents, origins, or crs do not match.
SpatRaster
bb2016 <- rast(system.file('extdata', 'bb2016.tif', package='bulkshift'))
bb2017 <- rast(system.file('extdata', 'bb2017.tif', package='bulkshift'))
ovlp <- overlap(bb2016, bb2017)
plot(ovlp)
#this function could be used to facilitate your own bespoke bulkshift, or to use a different model
err <- c(ovlp$bb2016 - ovlp$bb2017)
names(err) <- "err"
model_rast <- c(err, ovlp$bb2017)
df <- as.data.frame(model_rast)
model <- glm(err ~ bb2017, data = df)
bb2017_shifted <- bb2017 + terra::predict(bb2017, model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.