Interactive maps using Mapbox GL and Deck.gl
mapdeck(token = 'your_token')
will give you a map. You then start adding layers by using one of the various add_*()
functions.
url <- 'https://raw.githubusercontent.com/plotly/datasets/master/2011_february_aa_flight_paths.csv'
flights <- read.csv(url)
flights$info <- paste0("<b>",flights$airport1, " - ", flights$airport2, "</b>")
mapdeck(token = key, style = mapdeck_style('dark')) %>%
add_arc(
data = flights
, origin = c("start_lon", "start_lat")
, destination = c("end_lon", "end_lat")
, stroke_from = "airport1"
, stroke_to = "airport2"
, tooltip = "info"
, layer_id = 'arclayer'
)
Mapdeck uses Mabox maps, and to use Mapbocx you need an access token
Mapdeck is also an htmlwidget
, so will work in a shiny application.
Examples of all plots and shiny can be found in the vignette