Skip to content

Instantly share code, notes, and snippets.

@natesheehan
Last active September 15, 2021 11:42
Show Gist options
  • Save natesheehan/11d39c511bd9767eb620d222ef46c702 to your computer and use it in GitHub Desktop.
Save natesheehan/11d39c511bd9767eb620d222ef46c702 to your computer and use it in GitHub Desktop.
## You need a valid access token from Mapbox
key = mapbox_token
set_token( key )
places = tibble::tribble(
~name, ~o_x, ~o_y, ~d_x, ~d_y,
"Home", -1.524, 53.819, -1.552, 53.807,
"Work", -1.552, 53.807, -1.560, 53.812,
"Park", -1.560, 53.812, -1.556, 53.802,
"Cafe", -1.556, 53.802, -1.524, 53.819
)
places_sf$id = seq_len(nrow(places_sf))
places_sf$stroke = sample(3:5, size = nrow(places_sf), replace = T)
mapdeck(style = mapdeck_style("dark"), pitch = 45 ) %>%
add_animated_line(
data = places
, layer_id = "line_layer"
, origin = c("o_x", "o_y")
, destination = c("d_x", "d_y")
, stroke_colour = "green"
, stroke_width = 5
, auto_highlight = TRUE
, trail_length = 1
, animation_speed = 1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment