nearblack | R Documentation |
This function provides an interface mirroring that of the GDAL
command-line app nearblack
. For a description of the
utility and the arguments that it takes, see the documentation at
https://gdal.org/programs/nearblack.html.
nearblack(
infile,
o = infile,
...,
of,
white,
color,
near,
nb,
setalpha,
setmask,
q,
co,
config_options = character(0),
dryrun = FALSE
)
infile |
Character. Path to a GDAL-supported readable datasource. |
o |
Optionally, a character string giving the path to a GDAL-supported output file. If not supplied, defaults to codeinfile=, indicating that the input file should be modified in place. |
... |
Here, a placeholder argument that forces users to supply exact names of all subsequent formal arguments. |
of, white, color, near, nb, setalpha, setmask, q, co |
See the GDAL project's nearblack documentation for details. |
config_options |
A named character vector with GDAL config
options, of the form |
dryrun |
Logical (default |
Silently returns path to o
.
Joshua O'Brien
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
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.