add functions - Overview

library(leaflet)

ls("package:leaflet") %>% .[grep("^add", .)]
##  [1] "addAwesomeMarkers"   "addCircleMarkers"    "addCircles"         
##  [4] "addControl"          "addEasyButton"       "addEasyButtonBar"   
##  [7] "addGeoJSON"          "addGraticule"        "addLabelOnlyMarkers"
## [10] "addLayersControl"    "addLegend"           "addMarkers"         
## [13] "addMeasure"          "addMiniMap"          "addPolygons"        
## [16] "addPolylines"        "addPopups"           "addProviderTiles"   
## [19] "addRasterImage"      "addRectangles"       "addScaleBar"        
## [22] "addSimpleGraticule"  "addTerminator"       "addTiles"           
## [25] "addTopoJSON"         "addWMSTiles"

add measure and mini map

leaflet(width = "100%") %>% addProviderTiles("CartoDB") %>%
  addMarkers(data = airports, popup = ~ name) %>%
  addMeasure(primaryLengthUnit = "kilometers") %>%
  addMiniMap()
sp::spDists(airports)
##          [,1]     [,2]
## [1,]   0.0000 103.7433
## [2,] 103.7433   0.0000

rleaflet tutorial


mapedit

devtools::install_github("bhaskarvk/leaflet.extras")
devtools::install_github("r-spatial/mapedit")

library(leaflet)
library(mapedit)

what_we_created <- leaflet() %>%
  addTiles() %>%
  edit_map()

mapedit