Search code examples
here-api

How to get SpeedLimit in HERE API


I'm developing a web app where I need to know speed limit of specific road. The call to API looks lie this:

$.get('http://cre.api.here.com/2/calculateroute.json',    
        'waypoint0=41.69758,-87.78397&waypoint1=41.70056,-87.77429&mode=fastest;car;&overlays=OVERLAYEXAMPLE1&storage=readonly&linkAttributes=speedLimit&app_id=XXX&app_code=YYY',
            function(data) {
                console.log(data.response);
            }
        );

The response I'm receiving does not contain "speedLimit" even when I'm explicitly requesting.

I found in documentation where it says: https://developer.here.com/documentation/geocoder/topics/resource-type-response-geocode.html#resource-type-response-geocode__link-info

Note: All link info attributes are subject to additional licensing. We reserve the right to require authorization on API level for all or individual attributes with future releases. Currently, only the SpeedLimit attribute requires authorization and the attribute is not included in LinkInfo if the client application is not authorized to receive this information.

Client says the app is authorized, so no issues should be with it.. but anyways I'm not receiving desired result-set which contains speed limit..

What I'm doing wrong?


Solution

  • You have to use legattributes=li to get speedLimit attribute of a link.

    Below is an example on how to get speedlimit for links(roads).

    https://route.cit.api.here.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&app_code=xxx&app_id=xxxx