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 apiKey
or app_id
and app_code
if you are using the app_id/app_code authentication (see the Identity & Access Management Developer Guide), type of route calculation and whether to take traffic into account.
The following example requests the fastest
route for a car
in the presence of a reversible lane without specifying the departure time (trip planning mode).
https://route.ls.hereapi.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
&apiKey={YOUR_API_KEY}
&verboseMode=0
If you do not specify the departure time, the exact time of entry to the time restricted lane is not known. In such cases, the JSON output contains a "restriction" warning note and time restricted maneuvers are allowed.
note : [ <1 elem>
0 : {
type : "restriction"
code : "timeDependentRestriction"
text : "Road may be temporarily closed"
}
]

The same behavior 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.

To force routing through a restricted reversible lane (by setting a waypoint exactly on this lane) and set the departure time inside the forbidden period results in a "violation" warning and a route that tries to avoid the restricted segment.
note : [ <1 elem>
0 : {
type : "violation"
code : "timeDependentRestriction"
text : "Road may be temporarily closed"
}
]
