Introduction to leaflet

Interactive Maps with leaflet in R

Rich Majerus

Vice President of Strategy & Planning, Queens University of Charlotte

leaflet

  • Open-source JavaScript library
  • Popular option for creating interactive mobile-friendly maps
  • Can be created using only R code via the htmlwidgets package

Organizations using leaflet

Interactive Maps with leaflet in R

leaflet Example: National Parks Service

National Parks Service Leaflet Map

Interactive Maps with leaflet in R

What We are Working Toward

All four year colleges with base and overlay groups

Interactive Maps with leaflet in R

Creating our First leaflet Map

library(leaflet)
leaflet() %>% 
   addTiles()

addTiles() example

Interactive Maps with leaflet in R

Where We are Going in Chapter 1

leaflet() %>% 
   addProviderTiles("CartoDB") %>% 
   addMarkers(lng = dc_hq$lon, 
              lat = dc_hq$lat,
              popup = dc_hq$hq)

DataCamp HQ map with popups

Interactive Maps with leaflet in R

Let's practice!

Interactive Maps with leaflet in R

Preparing Video For Download...