Mosaic View
mosaic_view(
mosaic,
r = 3,
g = 2,
b = 1,
re = 4,
nir = 5,
title = "",
viewer = c("mapview", "base"),
show = c("rgb", "index"),
index = "B",
max_pixels = 5e+05,
downsample = NULL,
alpha = 1,
quantiles = c(0, 1),
domain = NULL,
color_regions = custom_palette(),
axes = FALSE,
...
)
An sf object, the same object returned by mapedit::editMap()
.
A mosaic of class SpatRaster
, generally imported with
mosaic_input()
.
The layer for the Red band (default: 3).
The layer for the Green band (default: 2).
The layer for the Blue band (default: 1).
The layer for the Red-edge band (default: 4).
The layer for the Near-infrared band(default: 5).
A title for the generated map or plot (default: "").
The viewer option. If not provided, the value is retrieved
using get_pliman_viewer()
. This option controls the type of viewer to use
for interactive plotting. The available options are "base" and "mapview".
If set to "base", the base R graphics system is used for interactive
plotting. If set to "mapview", the mapview package is used. To set this
argument globally for all functions in the package, you can use the
set_pliman_viewer()
function. For example, you can run
set_pliman_viewer("mapview")
to set the viewer option to "mapview" for
all functions.
The display option for the map view. Options are "rgb" for RGB view and "index" for index view.
The index to use for the index view. Defaults to "B".
Maximum number of pixels to render in the map or plot (default: 500000).
Downsampling factor to reduce the number of pixels
(default: NULL). In this case, if the number of pixels in the image (width
x height) is greater than max_pixels
a downsampling factor will be
automatically chosen so that the number of plotted pixels approximates the
max_pixels
.
opacity of the fill color of the raster layer(s).
the upper and lower quantiles used for color stretching. If
set to NULL
, stretching is performed basing on 'domain' argument.
the upper and lower values used for color stretching. This is
used only if 'quantiles'
is NULL
. If both 'domain'
and 'quantiles'
are
set to NULL
, stretching is applied based on min-max values.
The color palette for displaying index values. Default
is custom_palette()
.
logical. Draw axes? Defaults to FALSE
.
Additional arguments passed on to terra::plot()
when viewer = "base"
.
The function can generate either an interactive map using the
'mapview' package or a static plot using the 'base' package, depending on
the viewer
and show
parameters. If show = "index" is used, the function
first computes an image index that can be either an RGB-based index or a
multispectral index, if a multispectral mosaic is provided.
if(interactive()){
library(pliman)
# Load a raster showing the elevation of Luxembourg
mosaic <- mosaic_input(system.file("ex/elev.tif", package="terra"))
# Generate an interactive map using 'mapview'
mosaic_view(mosaic)
# Generate a static plot using 'base'
mosaic_view(mosaic, viewer = "base")
}
Run the code above in your browser using DataLab