0

I used gmapdistance to calculate travel time between two points in New York at different times. Can someone please tell me why is the travel time same and is not varying with time of day?

library(gmapsdistance)
library(lubridate)

# key is set

temp1 = gmapsdistance(
  origin = "40.75905289665592+-73.97693625311344",
  destination = "40.76264792279165+-73.99683999171252",
  mode = "driving",
  key = key,
  departure = as.numeric(ymd_hms("2021-09-11 15:00:00"))
)
temp1$Time


temp2 = gmapsdistance(
  origin = "40.75905289665592+-73.97693625311344",
  destination = "40.76264792279165+-73.99683999171252",
  mode = "driving",
  key = key,
  departure = as.numeric(ymd_hms("2021-09-11 19:00:00"))
)
temp2$Time

temp3 = gmapsdistance(
  origin = "40.75905289665592+-73.97693625311344",
  destination = "40.76264792279165+-73.99683999171252",
  mode = "driving",
  key = key,
  departure = as.numeric(ymd_hms("2021-09-11 23:00:00"))
)
temp3$Time
Palantir
  • 15
  • 6
SiH
  • 1,378
  • 4
  • 18
  • Distance is only 1.3 miles so I wouldn't expect the duration to vary too much. That said, trying your coords on my side, I get slightly different results. – MrUpsidown Sep 10 '21 at 07:52
  • ^^ at different times of the day. – MrUpsidown Sep 10 '21 at 14:52
  • 2
    I started getting different travel times once I added another argument - `traffic_model` – SiH Sep 10 '21 at 16:38
  • The rdocumentation suggested that `departure` is the time and distance can be computed at the desired time of departure. The option departure is the number of seconds since January 1, 1970 00:00:00 UCT. – SiH Sep 10 '21 at 16:57

0 Answers0