Powered by Zoomin Software. For more details please contactZoomin

HERE Routing API v8 - Developer Guide

Product category
Technology
Doc type
Version
Product lifecycle
This publication

HERE Routing API v8 - Developer Guide: Calculate a route with driver schedule

Table of Contents
HomeHERE Routing API v8 - Developer GuideCalculate a route with driver scheduleCurrent page
Table of Contents

Calculate a route with driver schedule

The driver[schedule] parameter is useful for calculating routes where the driver needs to take scheduled rest breaks. The parameter value is a comma-separated list of durations (in seconds), alternating between maximum allowed drive duration and rest duration.

Let's say the driver plans a route where he wants to drive 4.5 hours, then take a break for 30 minutes, followed by another 4.5 hours of driving and another 11 hours of rest. Such a sequence is encoded as driver[schedule]=16200,1800,16200,39600. Please note that durations are positive integers greater than 0. If you wish to add some rest time at the departure point before the driver can start, you should add the required rest time to the departure time value. This should provide the desired route. You can't specify 0 as the rest time.

With the given example above, the route will be split into at least two sections with drive time, each close to 16200 seconds. Each section will have a wait post action with a duration equal to the rest time (1800 and 39600 respectively).

{
  "postActions": [
    {
      "action": "wait",
      "duration": 1800
    }
  ]
}

If the travel time of a route exceeds the total period of drive time in the schedule, the section (or sections, if there are any via waypoints in the route plan) after the scheduled drive time will be added without wait actions, but they will contain a notice travelTimeExceedsDriverWorkHours.

Example request and response. Note that the route is split according to the schedule.

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=37.409438,-6.043584&'\
'destination=43.574211,1.424529&'\
'return=polyline,summary,actions,instructions&'\
'transportMode=truck&'\
'driver[schedule]=16200,1800,16200,39600&'\
'apiKey={YOUR_API_KEY}'
{
  "routes": [
    {
      "id": "7b316838-eaba-49b7-9419-ddce4c97162a",
      "sections": [
        {
          ...,
          "id": "99b4e3f6-cdd9-4e52-a4ed-3f15423a8fba",
          "postActions": [
            {
              "action": "wait",
              "duration": 900
            }
          ],
          "summary": {
            "baseDuration": 16871,
            "duration": 16871,
            "length": 380112
          },
          "transport": {
            "mode": "truck"
          },
          "type": "vehicle"
        },
        {
          ...,
          "id": "7aff75f1-fe0a-4a5b-b4d5-32757101aa62",
          "postActions": [
            {
              "action": "wait",
              "duration": 39600
            }
          ],
          "summary": {
            "baseDuration": 55576,
            "duration": 55576,
            "length": 389440
          },
          "transport": {
            "mode": "truck"
          },
          "type": "vehicle"
        },
        {
          ...,
          "id": "721c295d-3b7c-48b7-98ab-bd5e314e71b8",
          "notices": [
            {
              "code": "travelTimeExceedsDriverWorkHours",
              "severity": "critical",
              "title": "Travel time exceeds maximum scheduled driver time"
            }
          ],
          "summary": {
            "baseDuration": 20882,
            "duration": 20882,
            "length": 485031
          },
          "transport": {
            "mode": "truck"
          },
          "type": "vehicle"
        }
      ]
    }
  ]
}

Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert