Routing API Developer's Guide

Requesting a Time Aware Route with Itinerary Warnings

To calculate directions that take into account time dependent restrictions, use the CalculateRouteRequest service specifying the start (waypoint0), the destination (waypoint1), and the departure time. Note that you also have to specify an app_id and app_code (see Acquiring Credentials ), type of route calculation and whether to take traffic into account.

In the following example the fastest route for a car in the presence of a reversible lane is requested without specifying departure time (trip planning mode).

https://route.cit.api.here.com/routing/7.2/calculateroute.json
?waypoint0=geo!stopOver!47.47524,-122.20498
&waypoint1=geo!stopOver!47.757346996393736,-122.34468922274789
&routeattributes=sh,bb
&legattributes=li
&maneuverattributes=all
&language=en-us
&mode=fastest;car
&metricSystem=metric
&combineChange=true
&jsonAttributes=41
&app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&verboseMode=0

When departure time is not specified, the exact time of entry to the time restricted lane is not known. In such case JSON output contains a "restriction" warning note and time restricted maneuver is allowed.

note : [ <1 elem>
  0 : {
    type : "restriction"
    code : "timeDependentRestriction"
    text : "Road may be temporarily closed"
  }
]
Figure 1. Example of allowed time restricted maneuver in trip planning mode.

The same behaviour is applied when the departure time is set to 2014-07-14T14:02:00, which is outside the forbidden period.

If the departure time is set to 2014-07-14T07:02:00, which is inside the forbidden period, no warning is provided and the route avoids the maneuver.

Figure 2. Example of avoided time restricted maneuver when departure time is inside the forbidden period.

When a user forces routing through restricted reversible lane (by setting a waypoint exactly on this lane) and the departure time is set inside the forbidden period, a "violation" warning is provided and the route tries to avoid restricted segment.

note : [ <1 elem>
  0 : {
    type : "violation"
    code : "timeDependentRestriction"
    text : "Road may be temporarily closed"
  }
]
Figure 3. Example of violated time dependent restriction.