testIntersection {voluModel}R Documentation

Test Intersection

Description

Tests whether two rasters overlap. Used in ⁠\code{\link[voluModel:diversityStack]{diversityStack}}⁠ function to verify all rasters in list overlap with the template raster.

Usage

testIntersection(a, b)

Arguments

a

The first SpatRaster object

b

The second SpatRaster object

Value

A logical vector stating whether the two inputs overlap

Examples


library(terra)
rast1 <- rast(ncol=10, nrow=10)
values(rast1) <- rep(0:1, 50)

rast2 <- rast(ncol=10, nrow=10)
values(rast2) <- c(rep(0, 50), rep(1,50))

testIntersection(rast1, rast2)

rast1 <- crop(rast1, ext(10, 20, 30, 40))
rast2 <- crop(rast2, ext(-20, -10, -40, -30))

testIntersection(rast1, rast2)


[Package voluModel version 0.2.2 Index]