Before you begin, ensure you have met the following requirement(s):
R >= 3.5.0installed.
Install the latest version released on CRAN:
Or install the development version from GitHub:
leaflet.multiopacity provides the function
addOpacityControls to include opacity sliders in leaflet map.
# Load libraries library(leaflet) library(leaflet.multiopacity) library(raster) # Create raster example 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") # Provide layerId, group or category to show opacity controls # If not specified, will render controls for all layers leaflet() %>% addProviderTiles("Wikimedia", layerId = "Wikimedia") %>% addRasterImage(r, layerId = "raster") %>% addAwesomeMarkers(lng = -2.79545, lat = 54.04321, layerId = "hospital", label = "Hospital") %>% addOpacityControls(layerId = c("raster", "hospital"), collapsed = FALSE, position = "topright", title = "Opacity Control")
For more information and examples, please take a look at the vignettes:
To contribute to
leaflet.multiopacity, follow these steps:
git checkout -b <branch_name>.
git commit -m '<commit_message>'
git push origin leaflet.multiopacity/<location>
Alternatively see the GitHub documentation on creating a pull request.
This project uses the following license: MIT License.