How to get SpeedLimit in HERE API

这一生的挚爱 提交于 2019-12-11 06:44:56

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/54240906/how-to-get-speedlimit-in-here-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!