Interactive Leaflet Map Demo

This webpage was generated using R Markdown and includes an interactive Leaflet map, as required by the assignment.

Below is a simple dataset of locations that will be plotted.

places <- tibble::tibble(
name   = c("San Francisco", "New York City", "London", "Tokyo"),
popup  = c("San Francisco, CA, USA",
"New York City, NY, USA",
"London, UK",
"Tokyo, Japan"),
lat    = c(37.7749, 40.7128, 51.5074, 35.6895),
lng    = c(-122.4194, -74.0060, -0.1278, 139.6917)
)

places
## # A tibble: 4 × 4
##   name          popup                    lat      lng
##   <chr>         <chr>                  <dbl>    <dbl>
## 1 San Francisco San Francisco, CA, USA  37.8 -122.   
## 2 New York City New York City, NY, USA  40.7  -74.0  
## 3 London        London, UK              51.5   -0.128
## 4 Tokyo         Tokyo, Japan            35.7  140.
leaflet(data = places) |>
addProviderTiles(providers$CartoDB.Positron) |>
addCircleMarkers(
lng = ~lng, lat = ~lat,
radius = 8,
color = "#0072B2",
fillColor = "#56B4E9",
fillOpacity = 0.8,
popup = ~popup,
label = ~name
) |>
addMiniMap(toggleDisplay = TRUE) |>
addLayersControl(
baseGroups = c("CartoDB.Positron"),
options = layersControlOptions(collapsed = TRUE)
)