Get arrival time without departure time

479 Views Asked by At

I am trying to get the travel time to a certain destination based on the time of arrival. It is available through Google Maps, But the API seems to force to enter a departure time... which I don't know. I just know the expected time of arrival.

yet...

https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&traffic_model=best_guess&destinations=San+Francisco|Victoria+BC&arrival_time=1505894400&key=MY-KEY

RETURNS: { "destination_addresses" : [], "error_message" : "Invalid request. Missing the 'departure_time' parameter.", "origin_addresses" : [], "rows" : [], "status" : "INVALID_REQUEST" }

Any clue? Thanks

1

There are 1 best solutions below

0
On

Remove the &traffic_model=best_guess:

This works for me:

https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&arrival_time=1505894400&key=MY-KEY