leaflet v2.0.4.1

0

Monthly downloads

0th

Percentile

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.

Readme

An R Interface to Leaflet Maps

R build status CRAN RStudio mirror downloads RStudio community

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

library(leaflet)
m = leaflet() %>% addTiles()
m  # a map with the default OSM tile layer

m = m %>% setView(-93.65, 42.0285, zoom = 17)
m

m %>% addPopups(-93.65, 42.0285, 'Here is the <b>Department of Statistics</b>, ISU')

Installation

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

# CRAN version
install.packages('leaflet')

# Or Github version
if (!require('devtools')) install.packages('devtools')
devtools::install_github('rstudio/leaflet')

Documentation

In addition to the usual R package documentation, we also have extensive docs and examples at: https://rstudio.github.io/leaflet/

Development

leaflet's JavaScript build tools use Node.js, along with yarn to manage the JavaScript packages.

Install yarn using the official instructions.

You can test that Node.js and yarn are installed properly by running the following commands:

node --version
yarn --version

To make additions or modifications to the JavaScript htmlwidgets binding layer, you must have all Node.js dependencies installed. Now you can build/minify/lint/test using yarn build, or run in "watch" mode by just running yarn watch. JS sources go into javascript/src and tests go into javascript/tests.

# install dependencies
yarn

# compile
yarn build

# watch
yarn watch

License

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

Last month downloads

Details

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/leaflet)](http://www.rdocumentation.org/packages/leaflet)