Skip to content

The Map Widget

The map widget and methods to manipulate it

leaflet() leafletOptions() leafletCRS()
Create a Leaflet map widget
setView() flyTo() fitBounds() flyToBounds() setMaxBounds() clearBounds()
Methods to manipulate the map widget
mapOptions()
Set options on a leaflet map object
leafletSizingPolicy()
Leaflet sizing policy

Graphics Elements

Adding and removing graphics

Layers & Groups

Control groups and switch layers on and off

addMapPane()
Add additional panes to leaflet map to control layer order
addLayersControl() layersControlOptions() removeLayersControl()
Add UI controls to switch layers on and off
showGroup() hideGroup()
Show or hide layer groups
groupOptions()
Set options on layer groups

Colors

Map variables to colors

colorNumeric() colorBin() colorQuantile() colorFactor()
Color mapping
previewColors()
Color previewing utility

Icons

icons()
Create a list of icon data
makeIcon()
Define icon sets
iconList()
Make icon set

Add-ons

Utility functions to add additional functionality to a leaflet map

Awesome Markers

addAwesomeMarkers()
Add Awesome Markers
awesomeIcons()
Create a list of awesome icon data
makeAwesomeIcon()
Make Awesome Icon
awesomeIconList()
Make awesome-icon set

Other

addMeasure()
Add a measure control to the map.
addScaleBar() scaleBarOptions() removeScaleBar()
Add or remove a scale bar
addGraticule()
Add a Graticule on the map
addSimpleGraticule()
Add a simple Graticule on the map
addTerminator()
Add a daylight layer on top of the map
addMiniMap()
Add a minimap to the map
easyButtonState() easyButton() addEasyButton() addEasyButtonBar()
Create an easyButton statestate

Shiny

Using leaflet in shiny

Extending Leaflet

Functions for extending leaflet

derivePoints() derivePolygons()
Normalize data to a data frame or Spatial object.
evalFormula()
Evaluate list members that are formulae, using the map data as the environment
expandLimits()
Notifies the map of new latitude/longitude of items of interest on the map
expandLimitsBbox()
Notifies the map of polygons of interest on the map
filterNULL()
Remove NULL elements from a list
getMapData()
Extract the map's data
dispatch() invokeMethod()
Extension points for plugins
validateCoords()
Utility function to check if a coordinates is valid
leafletDependencies
Various leaflet dependency functions for use in downstream packages

Built in datasets

Spatial datasets exported by leaflet

atlStorms2005
Atlantic Ocean storms 2005
breweries91
Selected breweries in Franconia
gadmCHE
Administrative borders of Switzerland (level 1)