library(terra)
x <- rast(matrix(1:90, ncol = 3), crs = "EPSG:3857")
# Nothing
compare_spatrasters(x, x)
# Different crs
y_nocrs <- x
crs(y_nocrs) <- NA
compare_spatrasters(x, y_nocrs)
# Different extent
compare_spatrasters(x, x[1:10, , drop = FALSE])
# Different resolution
y_newres <- x
res(y_newres) <- res(x) / 2
compare_spatrasters(x, y_newres)
# Everything
compare_spatrasters(x, project(x, "epsg:3035"))
Run the code above in your browser using DataLab