I have a destination that is reachable faster via a way that is not allowed for trucks. Except for when the truck's next stop is near this restricted road. Which option allows me to include this restricted route in the response?
I am looking for a way to include the restricted segment (weight restriction or truck not allowed restriction) in the route of the response.
This is an example request: I tried with onRoadThreshold
, but it is not the way to go.
https://router.hereapi.com/v8/routes?apikey=DEFAULT_API_KEY&origin=48.277814,7.393936;onRoadThreshold=40000&destination=48.266218,7.162331;onRoadThreshold=40000&return=polyline,summary,actions¤cy=EUR&transportMode=truck&routingMode=fast&vehicle[grossWeight]=25000&vehicle[type]=tractor&traffic[mode]=default
EDIT
I am looking for a param like truckRestrictionPenalty=soft
which we had in V7 (docs)
There isn't a direct parameter called "truckRestrictionPenalty" like there was in the HERE Routing API v7. Nonetheless, you can use the {avoid[features]} argument to get a comparable result. You can indicate which features or limitations to avoid during routing by using this parameter.
You can set up the request as follows for your particular situation, where you wish to include a restricted road in the itinerary if the truck's next stop is close to that road:
You are instructing the routing engine to avoid routes that have truck limitations by providing {&avoid[features]=truckRestriction} in this request. The restricted road may still be used by the routing engine, though, if it considerably cuts down on travel time, particularly if the next stop is close to it.