create animation of vehicle moving along a route "with timeline of events"

Viewed 322

This is a followup question on How to create animation of vehicle moving form A to B along a route?. I could learn how to animate vehicles moving from A to B along the route. Thanks for the help!

But is it possible to make a self explanatory video (for a hypothetical client) by adding timeline (with a moving marker showing the instantaneous time and the corresponding event). Example of timeline

For example - Here is a sample sequence of events -

enter image description here

library(sf)
library(dplyr)
library(tidygeocoder)
library(osrm)
library(lubridate)

# adresses
adresses <- c("285 Fulton St, New York, NY 10007", # One World Trade Center
              "11 Madison Ave, New York, NY 10010",
              "Rockefeller Center, 45 Rockefeller Plaza, New York, NY 10111")

# geocoded addresses
geocoded_addresses <- tidygeocoder::geo(adresses, method = "osm") %>%
  st_as_sf(coords = c("long", "lat"), crs = 4326)

# reference time
t <- as_datetime("2021-08-23 8:00:00", tz = "America/New_York")

timeline <- tibble(
  time = c(t, t+minutes(10), t+minutes(12), NA, t+minutes(25), t+minutes(30), t+minutes(32), NA, t+minutes(38), NA),
  events = c("Wait", "Ride request", "Start trip", "End trip", "Ride request", "Start trip", "Ride request", "End trip", "Start trip", "End trip")
)

0 Answers
Related