I am sure it's possible to retrieve speed limit on the road based on coordinates. I just can't find any example (rest API). As I understand I need to use routing mechanism to do that?

有帮助吗?

解决方案

You will need to use the getLinkInfo endpoint from the Enterprise Routing API.. The speedLimit element returned is in m/s so multiply by 3.6 for km/h or 2.23 for mph. If the speedLimit element is missing then the national speed limit applies.

http://route.st.nlp.nokia.com/routing/6.2/getlinkinfo.json?waypoint=52.5308,13.3846&app_id=your_app_id&app_code=your_app_code

A working example can be found on the HERE Maps Community Examples on GitHub

其他提示

UDPATE: For others that see this question now:

The answer above doesn't work anymore (it doesn't return anything) - you need to use API 7.2 now:

http://route.st.nlp.nokia.com/routing/7.2/getlinkinfo.json?waypoint=52.5308,13.3846&app_id=your_app_id&app_code=your_app_code

Maybe that helps someone!

UPDATE

getlinkinfo will depreciated 31.03.2017. You will have to use Platform Data Extension.

HERE Speed Limit via PDE Demo

--------------

UPDATE - 2

I've got an email from HERE:

In December 2016, we informed our customers that we will retire the getlinkinfo (beta) functionality of the HLP Router API 7.2 by March 31, 2017 and that we would like to ask you to migrate to the Platform Data Extension by this date.

Based on the feedback that we received from several customers we decided to extend the time for migration and keep getlinkinfo available until June 30, 2017 and informed our customers accordingly.

At the moment this gives you the speed limit from HERE:

https://route.cit.api.here.com/routing/7.2/calculateroute.json?waypoint0=52.5308,13.3846&waypoint1=52.5308,13.3846&legattributes=li&mode=fastest;car&app_code=your_app_code&app_id=your_app_id

To get the speed limit you need to pass the argument legattributes=li. The speedLimit element is still returned in m/s so multiply by 3.6 for km/h or 2.23 for mph as Jason Fox mentioned.

UPDATE: Since Nokia maps renamed to HERE maps, its good practice to use their new HERE API.

Check their documentation how to use it with GPS coordinates.

You may use the HERE ReverseGeocoder with parameter "locationattributes=linkInfo" to get the speed and some more usefull information. Example response:

  linkInfo: {
     functionalClass: 5,
     travelDirection: [
        "NE"
     ],
     speedCategory: "SC7",
     speedLimit: [
        {
           value: 30,
           unit: "kph"
        }
     ],
     linkFlags: [
        "Paved"
     ],
     accessFlags: [
        "Automobiles",
        "Motorcycles",
        "Buses",
        "Taxis",
        "Carpools",
        "Pedestrians",
        "Trucks",
        "Deliveries",
        "EmergencyVehicle",
        "ThroughTraffic"
     ]
  }

See the full details at https://developer.here.com/documentation/geocoder/topics/resource-reverse-geocode.html

**

Version 8.3 Here map 2020

**

For Getting Speed Limit you must pass 2 value

spans=speedLimit

return=polyline

https://router.hereapi.com/v8/routes?apiKey=APP_KEY&transportMode=car&origin=-37.956650,145.220673&destination=-37.956650,145.220673&spans=speedLimit&return=polyline

in result you will get this:

                "polyline": "BG1j2soC6iy_0IAA",
                "spans": [
                    {
                        "offset": 0,
                        "speedLimit": 100.0
                    }
                ],

for more information please check this link:

Here Map V.8.3.1

getlinkinfo will depreciated 31.03.2017. You will have to use Platform Data Extension.

I found what you were looking for:

https://route.cit.api.here.com/routing/7.2/getlinkinfo.json?app_id=APP_ID&app_code=APP_CODE&mode=car&waypoint=-37.732895,144.853912&linkattributes=all

Hope this help.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top