Description Usage Arguments Author(s) Examples
Add opacity slider control to map
1 | addOpacitySlider(map, layerId)
|
map |
Leaflet map |
layerId |
Opacity layer |
Marc Becker
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Libraries
library(leaflet)
library(leaflet.opacity)
library(raster)
# Create artificial layer
r <- raster(xmn = -2.8, xmx = -2.79, ymn = 54.04, ymx = 54.05, nrows = 30, ncols = 30)
values(r) <- matrix(1:900, nrow(r), ncol(r), byrow = TRUE)
crs(r) <- CRS("+init=epsg:4326")
# Create leaflet map with opacity slider
leaflet() %>%
addTiles() %>%
addRasterImage(r, layerId = "raster") %>%
addOpacitySlider(layerId = "raster")
|
Loading required package: sp
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded datum World Geodetic System 1984 in CRS definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
4: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded datum World Geodetic System 1984 in CRS definition
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.