View source: R/addStarsImage.R
| addStarsImage | R Documentation |
Add stars layer to a leaflet map
addStarsImage(
map,
x,
band = 1,
colors = "Spectral",
opacity = 1,
attribution = NULL,
layerId = NULL,
group = NULL,
project = FALSE,
method = c("auto", "bilinear", "near", "average", "mode", "cubic", "cubicspline",
"lanczos", "sum", "min", "q1", "median", "q3", "max", "rms"),
maxBytes = 4 * 1024 * 1024,
options = gridOptions(),
data = getMapData(map),
...
)
map |
a mapview or leaflet object. |
x |
a stars layer. |
band |
the band number to be plotted. |
colors |
the color palette (see |
opacity |
the base opacity of the raster, expressed from 0 to 1 |
attribution |
the HTML string to show as the attribution for this layer |
layerId |
the layer id |
group |
the name of the group this raster image should belong to (see
the same parameter under |
project |
if |
method |
character. Method used for estimating the new cell values of a SpatRaster. One of:
|
maxBytes |
the maximum number of bytes to allow for the projected image (before base64 encoding); defaults to 4MB. |
options |
a list of additional options, intended to be provided by
a call to |
data |
the data object from which the argument values are derived; by
default, it is the |
... |
currently not used. |
This is an adaption of addRasterImage. See that documentation
for details.
Note, method auto, the default, will choose between near for factorial and
bilinear for numeric data. All other methods need to be set manually.
library(stars)
library(leaflet)
tif = system.file("tif/L7_ETMs.tif", package = "stars")
x = read_stars(tif)
leaflet() %>%
addProviderTiles("OpenStreetMap") %>%
addStarsImage(x, project = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.