mosaic_draw | R Documentation |
Drawing Lines or Polygons with Raster Information
mosaic_draw(
mosaic,
r = 3,
g = 2,
b = 1,
re = 4,
nir = 5,
index = "NGRDI",
show = "rgb",
segment = FALSE,
viewer = c("mapview", "base"),
threshold = "Otsu",
invert = FALSE,
summarize_fun = NULL,
buffer = 2,
color_regions = rev(grDevices::terrain.colors(50)),
alpha = 1,
max_pixels = 1e+06,
downsample = NULL,
quantiles = c(0, 1),
plot = TRUE,
plot_layout = c(1, 2, 3, 3)
)
mosaic |
A mosaic of class |
r , g , b , re , nir |
The red, green, blue, red-edge, and near-infrared bands of the image, respectively. By default, the function assumes a BGR as input (b = 1, g = 2, r = 3). If a multispectral image is provided up to seven bands can be used to compute built-in indexes. There are no limitation of band numbers if the index is computed using the band name. |
index |
The index to use for the index view. Defaults to "B". |
show |
The display option for the map view. Options are "rgb" for RGB view and "index" for index view. |
segment |
Should the raster object be segmented? If set to |
viewer |
The viewer option. If not provided, the value is retrieved
using |
threshold |
By default (threshold = "Otsu"), a threshold value based on Otsu's method is used to reduce the grayscale image to a binary image. If a numeric value is informed, this value will be used as a threshold. |
invert |
Inverts the mask if desired. Defaults to |
summarize_fun |
An optional function or character vector. When
|
buffer |
Adds a buffer around the geometries of the SpatVector created.
Note that the distance unit of |
color_regions |
The color palette for displaying index values. Defaults
to |
alpha |
opacity of the fill color of the raster layer(s). |
max_pixels |
Maximum number of pixels to render in the map or plot (default: 500000). |
downsample |
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 |
quantiles |
the upper and lower quantiles used for color stretching. |
plot |
Plots the draw line/rectangle? Defaults to |
plot_layout |
The de plot layout. Defaults to |
The mosaic_draw
function enables you to create mosaic drawings from
remote sensing data and compute vegetation indices.
If a line is drawn using the "Draw Polyline" tool, the profile of index
is
displayed on the y-axis along the line's distance, represented in meter
units. It is important to ensure that the Coordinate Reference System (CRS)
of mosaic
has latitude/longitude units for accurate distance
representation.
If a rectangle or polygon is drawn using the "Draw Rectangle" or "Draw Polygon"
tools, the index
values are calculated for each object. By default, the
raw data is returned. You can set the summarize_fun
to compute a summary
statistic for each object.
An invisible list containing the mosaic, draw_data, distance, distance_profile, geometry, and map.
if(interactive()){
library(pliman)
# Load a raster showing the elevation of Luxembourg
mosaic <- mosaic_input(system.file("ex/elev.tif", package="terra"))
# draw a polyline to see the elevation profile along the line
mosaic_draw(mosaic, buffer = 1500)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.