# \donttest{
td <- tempdir()
a_rast <- file.path(td, "a.tif")
b_rast <- file.path(td, "b.tif")
file.copy(system.file("extdata/tahoe.tif", package = "gdalUtilities"),
a_rast)
file.copy(system.file("extdata/tahoe.tif", package = "gdalUtilities"),
b_rast)
nearblack(a_rast, b_rast, of = "GTiff", near = 150)
## Check that it worked
if(require(terra)) {
op <- par(mfcol = c(1, 2))
r1 <- plot(rast(a_rast))
r2 <- plot(rast(b_rast))
par(op) ## Reset preexisting parameters
}
# }
Run the code above in your browser using DataLab