Here Maps REST API - getlinkinfo returns incorrect speed limit
Asked Answered
T

1

1

I have been using the getlinkinfo command to look at speed limits. The values returned by the API appear to be reduced by a factor of 3.6 relative to posted speed limits on roads in my community. For example, here is a request for a road segment of Highway 101 in Fredericton, NB, Canada that has a posted speed Limit of 90 kph:

http://route.st.nlp.nokia.com/routing/6.2/getlinkinfo.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&waypoint=45.921339,-66.666753&linkattributes=sc,sl

(Short link - http://goo.gl/EWfKDe)

This request returns a speed limit of "25" and the actual posted speed limit is 90. Can you tell me why the <SpeedLimit> values do not contain the actual posted speed limit?  Is it because I am using the "DemoAppId"?

Bernie.

Tetradymite answered 2/4, 2014 at 19:24 Comment(0)
L
9

The speedLimit element is always returned in m/s so you'll need to use a conversion factor to obtain to the typical road sign units. Multiply by 3.6 for km/h or 2.23 for mph. If the speedLimit element is missing then the national speed limit applies.

Why chose m/s you may ask? I reckon this has been done to avoid rounding errors in calculations by consistently using the smallest distance unit (metre) and the smallest time unit (second) across the HERE platform. I assume that the data underlying getlinkinfo is used when calculating routes.

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

Laski answered 2/4, 2014 at 19:44 Comment(1)
Thank for for the answer -- that 3.6 was driving me crazy. A couple of points: a lot of the here github resources still have nokia in the URL, which means they are broken; and it would be nice if the API docs were more explicit about using m/s. It is perfectly reasonable, but I don't see it explicitly stated on the demo page: developer.here.com/api-explorer/rest/routing/…. The roads.googleapis.com service explicitly returns the units.Volplane

© 2022 - 2024 — McMap. All rights reserved.