addImageQuery | R Documentation |
Add image query functionality to leaflet/mapview map.
addImageQuery(
map,
x,
band = 1,
group = NULL,
layerId = NULL,
project = TRUE,
type = c("mousemove", "click"),
digits,
position = "topright",
prefix = "Layer",
className = "",
...
)
map |
the map with the RasterLayer to be queried. |
x |
the RasterLayer that is to be queried. |
band |
for stars layers, the band number to be queried. |
group |
the group of the RasterLayer to be queried. |
layerId |
the layerId of the RasterLayer to be queried. Needs to be the
same as supplied in |
project |
whether to project the RasterLayer to conform with leaflets
expected crs. Defaults to |
type |
whether query should occur on 'mousemove' or 'click'. Defaults to 'mousemove'. |
digits |
the number of digits to be shown in the display field. |
position |
where to place the display field. Default is 'topright'. |
prefix |
a character string to be shown as prefix for the layerId. |
className |
a character string to append to the control legend. |
... |
currently not used. |
This function enables Raster*/stars objects added to leaflet/mapview maps to
be queried. Standard query is on 'mousmove', but can be changed to 'click'.
Note that for this to work, the layerId
needs to be the same as the
one that was set in addRasterImage
or
addStarsImage
. Currently only works for
numeric values (i.e. numeric/integer and factor values are supported).
A leaflet map object.
if (interactive()) {
if (requireNamespace("plainview")) {
library(leaflet)
library(plainview)
leaflet() %>%
addProviderTiles("OpenStreetMap") %>%
addRasterImage(poppendorf[[1]], project = TRUE, group = "poppendorf",
layerId = "poppendorf") %>%
addImageQuery(poppendorf[[1]], project = TRUE,
layerId = "poppendorf") %>%
addLayersControl(overlayGroups = "poppendorf")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.