leaflet 2.0.0
leaflet 2.0.0 is now on CRAN!
The leaflet R package wraps the Leaflet.js JavaScript library, and this release of the R package marks a major upgrade from the outdated Leaflet.js 0.7.x to the current Leaflet.js 1.x (specifically, 1.3.1).
Leaflet.js 1.x includes some non-backward-compatible API changes versus 0.7.x. If you’re using only R code to create your Leaflet maps, these changes should not affect you. If you are using custom JavaScript, some changes may be required to your code. Please see the Leaflet.js reference documentation and changelog.
Big thanks to @timelyportfolio and Bhaskar Karambelkar for their significant contributions to this release!
Two additional packages by Bhaskar, leaflet.extras and leaflet.esri, have been updated on CRAN to utilize the latest Leaflet.js library bindings. leaflet.extras extends the Leaflet R package using various Leaflet.js plugins, offering features like heatmaps, additional marker icons, and drawing tools. leaflet.esri provides access to ArcGIS services, based on the ESRI leaflet plugin.
library(leaflet)
library(leaflet.extras)
leaflet(quakes) %>%
addTiles() %>%
addHeatmap(lng = ~long, lat = ~lat, radius = 8)
L.Label
to L.Tooltip
.*.bindLabel()
to *.bindTooltip()
.devtools::install_github("rstudio/leaflet")
). For now, you can work around this in the CRAN version by including this line in your application UI:tags$style(".leaflet-map-pane { z-index: auto; }")
addProviderTiles()
: OpenStreetMap.CH, OpenInfraMap, OpenInfraMap.Power, OpenInfraMap.Telecom, OpenInfraMap.Petroleum, OpenInfraMap.Water, OpenPtMap, OpenRailwayMap, OpenFireMap, SafeCast.groupOptions
function. Currently the only option is letting you specify zoom levels at which a group should be visible.method
argument to addRasterImage()
to enable nearest neighbor interpolation when projecting categorical rasters.'auto'
method for addRasterImage()
. Projected factor results are coerced into factors.data
parameter to remaining addXXX()
methods, including addLegend.preferCanvas
argument to leafletOptions()
. ### Bug Fixes and ImprovementsL.multiPolyline
was absorbed into L.polyline
, which also accepts an array of polyline information.L.Label
is now L.tooltip
in Leaflet.js. labelOptions()
now translates old options clickable
to interactive
and noHide
to permanent
.addTiles()
would not work with .html files served directly from the filesystem..indexOf(stamp)
.validateCoords()
warns on invalid polygon data.