Search code examples
google-mapsmapsdriving-directions

Generate efficient map route with one or more specific arrival times


I am looking for a specific feature from a Map Routing API service.

After doing a bit of research, I have found that the Google Directions API will not supply all the features I require from this service.

Has anyone found/know of a viable/potential solution I could further investigate?

Required API Features

  • To be able to specify an arrival time & duration for individual driving direction waypoints.
  • If a arrival time is not specified it will treat the waypoint dynamically for optimisation.
  • This will allow for an optimised route to be generated but with some waypoints having a specific appointment time.

Example Case

  • A user has a total of 6 waypoints in a single day’s agenda.
  • One appointment has a specific time for arrival at 1pm.
  • All other appointments are not time critical and can be dynamically generated in the most efficient and optimised route.

Currently Supported

  • There is a similar feature in the Google Directions API called ARRIVAL_TIME. Which appears to be unavailable for driving directions. https://developers.google.com/maps/documentation/directions/intro#RequestParameters
    • departure_time — Specifies the desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. Alternatively, you can specify a value of now, which sets the departure time to the current time (correct to the nearest second). The departure time may be specified in two cases:
      • For transit directions: You can optionally specify one of departure_time or arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).
      • For driving directions: Google Maps API for Work customers can specify the departure_time to receive trip duration considering current traffic conditions. The departure_time must be set to within a few minutes of the current time.
    • arrival_time — Specifies the desired time of arrival for transit directions, in seconds since midnight, January 1, 1970 UTC. You can specify either departure_time or arrival_time, but not both. Note that arrival_time must be specified as an integer.
      • Unfortunately this feature is only available for MASS TRANSIT and not for DRIVING INSTRUCTIONS.

Other API Technologies

  • Routific - These guys offer the exact API implementation we require.
  • https://docs.routific.com/docs/input - The VISITS object appears to do exactly what I need.
    • The visits object is a hash of each visit and their properties, where the key is the visit ID. Each visit object has to contain a location object with the geographic coordinates. Note that the name parameter in the location object is optional.
    • Each visit can have a time-window constraint, defined by start and end. Time windows are optional; when they are not provided, it implies that any time will do. You can also say "anytime after 9am" by setting the start time to 9:00 and omitting the end parameter. Duration specifies how many minutes the visit takes. If a delivery takes 30 minutes and is given a time-window of 12:00-13:00, the algorithm will make sure that you arrive by 12:30 at the latest.

Solution

  • It appears that the Google API will support this feature in the very near future. I had a meeting with a few friendly folks who resell the Google API and they said to sit tight and wait for the next API release. It may not be available to the public, but it will definitely be available via paid API access.

    I will update this answer with more information as it comes to light.