Create Interactive Web Maps with the JavaScript 'Leaflet' Library

Create and customize interactive maps using the 'Leaflet' JavaScript library and the 'htmlwidgets' package. These maps can be used directly from the R console, from 'RStudio', in Shiny apps and R Markdown documents.

Leaflet is an open-source JavaScript library for interactive maps. This R package makes it easy to create Leaflet maps from R.

m = leaflet() %>% addTiles()
m  # a map with the default OSM tile layer
m = m %>% setView(-93.65, 42.0285, zoom = 17)
m %>% addPopups(-93.65, 42.0285, 'Here is the <b>Department of Statistics</b>, ISU')

This package is not on CRAN yet, but you can install it from Github:

if (!require('devtools')) install.packages('devtools')

In addition to the usual R package documentation, we also have extensive docs and examples at:

This package is licensed to you under the terms of the GNU General Public License version 3 or later.

Copyright 2013-2015 RStudio, Inc.


  • Fix #242: Compatibility with htmlwidgets 0.6 (thanks byzheng).
  • Initial release

Reference manual

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


1.1.0 by Joe Cheng, 9 months ago

Report a bug at

Browse source code at

Authors: Joe Cheng [aut, cre], Bhaskar Karambelkar [aut], Yihui Xie [aut], Hadley Wickham [ctb], Kenton Russell [ctb], Kent Johnson [ctb], jQuery Foundation and contributors [ctb, cph] (jQuery library), Vladimir Agafonkin [ctb, cph] (Leaflet library), CloudMade [cph] (Leaflet library), Leaflet contributors [ctb] (Leaflet library), Leaflet Providers contributors [ctb, cph] (Leaflet Providers plugin), Brandon Copeland [ctb, cph] (leaflet-measure plugin), Jacob Toye [ctb, cph] (Leaflet.label plugin), Joerg Dietrich [ctb, cph] (Leaflet.Terminator plugin), Benjamin Becquet [ctb, cph] (Leaflet.MagnifyingGlass plugin), Norkart AS [ctb, cph] (Leaflet.MiniMap plugin), L. Voogdt [ctb, cph] (Leaflet.awesome-markers plugin), Daniel Montague [ctb, cph] (Leaflet.EasyButton plugin), Kartena AB [ctb, cph] (Proj4Leaflet plugin), Robert Kajic [ctb, cph] (leaflet-locationfilter plugin), Mapbox [ctb, cph] (leaflet-omnivore plugin), Michael Bostock [ctb, cph] (topojson), RStudio [cph]

Documentation:   PDF Manual  

GPL-3 license

Imports base64enc, crosstalk, htmlwidgets, htmltools, magrittr, markdown, methods, png, RColorBrewer, raster, scales, sp, stats, viridis

Suggests knitr, maps, sf, shiny, testit, rgdal, rgeos, R6, RJSONIO, purrr, testthat

Imported by PWFSLSmoke, QRAGadget, SpatialEpiApp, antaresViz, eAnalytics, futureheatwaves, geoSpectral, inlmisc, jpmesh, jpndistrict, leaflet.minicharts, leafletCN, lingtypology, mapedit, mapr, metScanR, neotoma, openwindfarm, stationaRy, teachingApps, tmap, trackeR, windfarmGA, worldmet.

Depended on by leaflet.esri, leaflet.extras, mapview, wallace.

Suggested by RSurvey, RgoogleMaps, Rnightlights, blscrapeR, cycleRtools, geojsonio, hddtools, lawn, macleish, manipulateWidget, mapsapi, nyctaxi, openadds, owmr, parlitools, rdefra, rdwd, rnoaa, statesRcontiguous, synthACS, tigris, tilegramsR, wellknown.

Enhanced by mregions.

See at CRAN