leaflet v2.0.2


Monthly downloads



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 applications and R Markdown documents.


An R Interface to Leaflet Maps

Build Status

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')


You can install this package from CRAN, or the development version from Github:

# CRAN version

# Or Github version
if (!require('devtools')) install.packages('devtools')


In addition to the usual R package documentation, we also have extensive docs and examples at: http://rstudio.github.io/leaflet You may use Github issues to file bug reports or feature requests, and ask questions on StackOverflow or in the Shiny mailing list.


To make additions or modifications to the JavaScript htmlwidgets binding layer, you must use Grunt to build and test. Please make sure Node.js is installed on your system, then run:

npm install -g grunt-cli
npm install

Now you can build/minify/lint/test using grunt build, or run in "watch" mode by just running grunt. JS sources go into javascript/src and tests go into javascript/tests.


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

Copyright 2013-2015 RStudio, Inc.

Functions in leaflet

Name Description
mapOptions Set options on a leaflet map object
addScaleBar Add or remove a scale bar
addSimpleGraticule Add a simple Graticule on the map see https://github.com/ablakey/Leaflet.SimpleGraticule
icons Create a list of icon data
addTerminator Add a daylight layer on top of the map
leaflet-imports Objects imported from other packages
filterNULL remove NULL elements from a list
expandLimitsBbox Same as expandLimits, but takes a polygon (that presumably has a bbox attr) rather than lat/lng.
gadmCHE Administrative borders of Switzerland (level 1)
addMapPane Add additional panes to leaflet map to control layer order
addMiniMap Add a minimap to the Map https://github.com/Norkart/Leaflet-MiniMap
getMapData returns the map's data
previewColors Color previewing utility
colorNumeric Color mapping
createLeafletMap Legacy functions
addMeasure Add a measure control to the map.
leafletSizingPolicy Leaflet sizing policy
leafletProxy Send commands to a Leaflet instance in a Shiny app
leafletOutput Wrapper functions for using leaflet in shiny
tileOptions Extra options for map elements and layers
addProviderTiles Add a tile layer from a known map provider
awesomeIcons Create a list of awesome icon data see https://github.com/lvoogdt/Leaflet.awesome-markers
breweries91 Selected breweries in Franconia
derivePoints Given a data object and lng/lat arguments (which may be NULL [meaning infer from data], formula [which should be evaluated with respect to the data], or vector data [which should be used as-is]) return a lng/lat data frame.
iconList Make icon set
groupOptions Set options on layer groups
derivePolygons Given a data object and lng/lat arguments (which may be NULL [meaning infer from data], formula [which should be evaluated with respect to the data], or vector data [which should be used as-is]) return a spatial object
addControl Graphics elements and layers
setView Methods to manipulate the map widget
removeControl Remove elements from a map
makeAwesomeIcon Make Awesome Icon
expandLimits Notifies the map of new latitude/longitude of items of interest on the map
evalFormula Evaluate list members that are formulae, using the map data as the environment (if provided, otherwise the formula environment)
dispatch Extension points for plugins
makeIcon Define icon sets
easyButtonState Create an easyButton statestate
showGroup Show or hide layer groups
validateCoords Utility function to check if a coordinates is valid
safeLabel Sanitize textual labels
providers Providers
providers.details Providers Details
addAwesomeMarkers Add Awesome Markers
addGraticule Add a Graticule on the map see https://github.com/turban/Leaflet.Graticule
leaflet Create a Leaflet map widget
leafletDependencies Various leaflet dependency functions for use in downstream packages
addRasterImage Add a raster image as a layer
atlStorms2005 Atlantic Ocean storms 2005
awesomeIconList Make awesome-icon set
addLayersControl Add UI controls to switch layers on and off
addLegend Add a color legend to a map
No Results!

Last month downloads


Include our badge in your README