Search code examples
here-apihere-maps-rest

Speed limit for multiple locations using HERE API


I need to know the speed limit for some coordinates from the vehicle's trip. If I do POST request like:

https://fleet.cit.api.here.com/2/calculateroute.json?routeMatch=1&mode=car&attributes=SPEED_LIMITS_FCn(*)&&app_id=APP_ID&app_code=APP_CODE

with body:
LATITUDE,LONGITUDE
37.401996,-122.041338
37.416438,-122.086022

I'm receiving back built route with very many coordinates. But I'm interested in only two coordinates... Is there a better way to get speed-limit for a few (~10-100) coordinates?


Solution

  • This will get an array of link and if speed limit is available in map data, it would be returned for the link. linkAttributes and routeAttributes will limit the response of parameters. the default response however can't be limited.

    https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey=xxx&waypoint0=42.4065,-113.3798&waypoint1=42.2821,-83.74847&mode=fastest;car&inkAttributes=speedLimit,dynamicSpeedInfo&legAttributes=links

    speedinfo can come via geocoder API in the form of speed category like below that will be based on the address location.

    https://geocoder.ls.hereapi.com/6.2/geocode.json?searchtext=Castro%20St%20Mountain%20View%20Santa%20Clara%20US&gen=9&apiKey=xxxxx&locationattributes=li