Add driver schedule on a truck route

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.

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 -X GET 'https://router.hereapi.com/v8/routes?apikey={YOUR_API_KEY}&origin=37.409438,-6.043584&destination=43.574211,1.424529&return=polyline,summary,actions,instructions&transportMode=truck&driver[schedule]=16200,1800,16200,39600'
{
  "routes" : [
    {
      "id" : "7b316838-eaba-49b7-9419-ddce4c97162a",
      "sections" : [
        {
          "arrival" : {
            "place" : {
              "location" : {
                "lat" : 40.36571,
                "lng" : -5.83282
              },
              "type" : "place"
            }
          },
          "departure" : {
            "place" : {
              "location" : {
                "lat" : 37.4031659,
                "lng" : -5.9855658
              },
              "originalLocation" : {
                "lat" : 37.4031999,
                "lng" : -5.9857921
              },
              "type" : "place"
            }
          },
          "id" : "99b4e3f6-cdd9-4e52-a4ed-3f15423a8fba",
          "postActions" : [
            {
              "action" : "wait",
              "duration" : 900
            }
          ],
          "summary" : {
            "baseDuration" : 16871,
            "duration" : 16871,
            "length" : 380112
          },
          "transport" : {
            "mode" : "truck"
          },
          "travelSummary" : {
            "baseDuration" : 15971,
            "duration" : 15971,
            "length" : 380112
          },
          "type" : "vehicle"
        },
        {
          "arrival" : {
            "place" : {
              "location" : {
                "lat" : 42.65055,
                "lng" : -3.07539
              },
              "type" : "place"
            }
          },
          "departure" : {
            "place" : {
              "location" : {
                "lat" : 40.36571,
                "lng" : -5.83282
              },
              "type" : "place"
            }
          },
          "id" : "7aff75f1-fe0a-4a5b-b4d5-32757101aa62",
          "postActions" : [
            {
              "action" : "wait",
              "duration" : 39600
            }
          ],
          "summary" : {
            "baseDuration" : 55576,
            "duration" : 55576,
            "length" : 389440
          },
          "transport" : {
            "mode" : "truck"
          },
          "travelSummary" : {
            "baseDuration" : 15976,
            "duration" : 15976,
            "length" : 389440
          },
          "type" : "vehicle"
        },
        {
          "arrival" : {
            "place" : {
              "location" : {
                "lat" : 43.5581371,
                "lng" : 1.3858864
              },
              "originalLocation" : {
                "lat" : 43.558096,
                "lng" : 1.3858439
              },
              "type" : "place"
            }
          },
          "departure" : {
            "place" : {
              "location" : {
                "lat" : 42.65055,
                "lng" : -3.07539
              },
              "type" : "place"
            }
          },
          "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"
          },
          "travelSummary" : {
            "baseDuration" : 20882,
            "duration" : 20882,
            "length" : 485031
          },
          "type" : "vehicle"
        }
      ]
    }
  ]
}

results matching ""

    No results matching ""