HERE Maps Routing API v8:街道属性

问题描述

我目前正在通过HERE Maps Routing API v8请求路线,

curl --location --request GET 'https://router.hereapi.com/v8/routes?apiKey={{someapikey}}&return=polyline&spans=functionalClass,streetAttributes&origin=38.577482,-121.858775&destination=38.682991,-121.576498&transportMode=truck'

这将返回包含functionClass和道路属性的结果,如下所示:

// ...
"spans": [
    {
        "offset": 0,"streetAttributes": [
            "rightDrivingSide"
        ],"functionalClass": 4
    },{
        "offset": 205,"streetAttributes": [
            "rightDrivingSide","dividedRoad"
        ],"functionalClass": 1
    }
// ...

哪个很棒,但是streetAttributes的任何可能值列表中都有?我只发现了https://developer.here.com/documentation/android-premium/3.16/api_reference_java/com/here/android/mpa/common/RoadElement.Attribute.html,它在某种程度上是相似的,但是很高兴知道streetAttributes返回的不同值。

解决方法

已记录,但您可能会错过它。转到API参考(https://developer.here.com/documentation/routing-api/8.6.4/api-reference-swagger.html)时,需要单击以打开200 OK响应,并且还必须单击响应的每个子项。如果您深入研究,则会找到我要在此处复制的streetAttributes文档:

StreetAttributes is applied to a span of a route section and describes attribute flags of a street.

rightDrivingSide: Do vehicles have to drive on the right-hand side of the road or the left-hand side.
dirtRoad: This part of the route has an un-paved surface.
tunnel: This part of the route is a tunnel.
bridge: This part of the route is a bridge.
ramp: This part of the route is a ramp (usually connecting to/from/between highways).
motorway: This part of the route is a controlled access road (usually highways).
roundabout: This part of the route is a roundabout.
underConstruction: This part of the route is under construction.
dividedRoad: This part of the route uses a road with a physical or legal divider in the middle.
privateRoad: This part of the route uses a privately owned road.
As it is possible that new street attributes are supported in the future,unknown street attributes should be ignored.