1

I am trying to understand how google_distance works for a single pair of origin/destination coordinates before writing a loop to run around 1200 calculations. My first attempt worked but I need to run calculations based on an arrival time. I tried to run the query directly with the Google API and it appears to be something about specific time in the past. Google maps will not give calculations for that period either. Jumping to the Google API help area for some specifics

First Attempt:

google_distance(origins = c(39.96877,-75.19973), destinations = c(39.96345,-75.16573), mode = "transit")

Adding the arrival_time parameter resulted in "ZERO_RESULTS" which should not be true.

google_distance(origins = c(39.96877,-75.19973), destinations = c(39.96345,-75.16573), mode = "transit", arrival_time = time)

returned

$destination_addresses
[1] "39.96345,-75.16573"

$origin_addresses
[1] "39.96877,-75.19973"

$rows
      elements
1 ZERO_RESULTS

$status
[1] "OK"

where

time = c(1540383240)
class(time) = c('POSIXct')

I know that there is a transit path available during the specified time so I'm not sure what has happened.

Rho
  • 21
  • 2
  • Your time is in the past, `2018-10-24`, change it to something in the (near) future and it works. – SymbolixAU Feb 24 '19 at 02:14
  • Yes thank you. I am roughly following an old protocol that calculated transit and car travel time (with traffic) for a historic date, but I think things have updated since then. I just looked at the traffic parameters and its based some type of historic averages instead of related back to a specific date. – Rho Feb 24 '19 at 02:31

0 Answers0