Opacity Controls for Leaflet Maps

Extends the 'leaflet' R package with the 'Leaflet.OpacityControls' JavaScript plugin. Adds controls to the leaflet map for adjusting the opacity of a layer.


General

leaflet.opacity extends the leaflet R package with the Leaflet.OpacityControls JavaScript plugin (LizardTech, 2013). It offers control buttons and a slider for adjusting the opacity of a layer.

Installation

You can install the released version of leaflet.opacity from CRAN with:

install.packages("leaflet.opacity")

or the latest version from GitHub with:

devtools::install_github("https://github.com/be-marc/leaflet.opacity", dependencies=TRUE)

Example

library(leaflet)
library(leaflet.opacity)
library(raster)
 
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")
 
leaflet() %>%
    addTiles() %>%
    addRasterImage(r, layerId = "raster") %>%
    addOpacitySlider(layerId = "raster")

Reference

LizardTech (2013). Leaflet.OpacityControls. Retrieved from https://github.com/lizardtechblog/Leaflet.OpacityControls

News

leaflet.opacity 0.1.0

General

  • Initial release of leaflet.opacity

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("leaflet.opacity")

0.1.0 by Marc Becker, a year ago


Report a bug at https://github.com/be-marc/leaflet.opacity


Browse source code at https://github.com/cran/leaflet.opacity


Authors: Marc Becker [aut, cre] (R interface) , LizardTech [aut, cph] (Leaflet.OpacityControls JavaScript library)


Documentation:   PDF Manual  


GPL-3 license


Imports htmltools, htmlwidgets

Suggests leaflet, raster, rgdal, magrittr, testthat, knitr, rmarkdown


See at CRAN