Search code examples
here-apihere-routing

Vehicle's height or width does not work in here/com rest api v8


I am exploring here.com rest api (v8) for the truck.

My rest api to get directions is as below:

https://router.hereapi.com/v8/routes?apiKey={my_api_key}&transportMode=truck&truck[width]=250000&origin=-33.947113,151.078804&destination=-33.86882,151.209296&return=polyline,actions,instructions&avoid[features]=tunnel

It seems like specifying the truck's height or width does not have any effect or is not recognized. I tried to put some very large values (truck[width]=250000) as well.

According to here.com official documentation, Rest api v8 we can specify the truck property as below:

truck[parameter-name]=value

What am I doing wrong?


Solution

  • You are specifying the truck property correctly, but it doesn't have any effect because there are no width restrictions in the area. The route is the same with or without the width property because the router didn't find any road that it needs to avoid because it's restricted for trucks of that dimension.

    There are however some height and weight restrictions in between your origin and destination. If you specify a height of 500 instead of a width, you will get a route result that looks different that the route you get when you don't set a height. Your query would look like this:

    https://router.hereapi.com/v8/routes?
    apikey=[YOUR_API_KEY]&
    origin=-33.947113,151.078804&
    destination=-33.86882,151.209296&
    return=polyline,summary,actions,instructions&
    transportMode=truck&
    truck[height]=500&
    avoid[features]=tunnel