我有一个 Here Maps 链接 ID 的列表。我想得到他们的几何形状。我尝试调用 v7 calculateroute REST API,在 waypoint0 和 waypoint1 中传递一个 link_id,如下所示,
https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey={API_KEY}&mode=fastest;car&waypoint0=link!-893783351&waypoint1=link!-893783351&routeAttributes=notes&linkAttributes=shape,speedLimit
{
"response": {
"metaInfo": {
"timestamp": "2021-09-28T04:03:39Z",
"mapVersion": "8.30.124.155",
"moduleVersion": "7.2.202138-9419",
"interfaceVersion": "2.6.77",
"availableMapVersion": [
"8.30.124.155"
]
},
"route": [
{
"waypoint": [
{
"linkId": "+893783351",
"mappedPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"originalPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"type": "stopOver",
"spot": 0.4929245,
"sideOfStreet": "neither",
"mappedRoadName": "",
"label": "",
"shapeIndex": 0,
"source": "user"
},
{
"linkId": "+893783351",
"mappedPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"originalPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"type": "stopOver",
"spot": 0.4929245,
"sideOfStreet": "neither",
"mappedRoadName": "",
"label": "",
"shapeIndex": 1,
"source": "user"
}
],
"mode": {
"type": "fastest",
"transportModes": [
"car"
],
"trafficMode": "disabled",
"feature": []
},
"shape": [
"26.711034,-80.1374786",
"26.711034,-80.1374786"
],
"leg": [
{
"start": {
"linkId": "+893783351",
"mappedPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"originalPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"type": "stopOver",
"spot": 0.4929245,
"sideOfStreet": "neither",
"mappedRoadName": "",
"label": "",
"shapeIndex": 0,
"source": "user"
},
"end": {
"linkId": "+893783351",
"mappedPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"originalPosition": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"type": "stopOver",
"spot": 0.4929245,
"sideOfStreet": "neither",
"mappedRoadName": "",
"label": "",
"shapeIndex": 1,
"source": "user"
},
"length": 0,
"travelTime": 0,
"maneuver": [
{
"position": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"instruction": "Take ramp.",
"travelTime": 0,
"length": 0,
"id": "M1",
"_type": "PrivateTransportManeuverType"
},
{
"position": {
"latitude": 26.711034,
"longitude": -80.1374786
},
"instruction": "Arrive at your destination.",
"travelTime": 0,
"length": 0,
"id": "M2",
"_type": "PrivateTransportManeuverType"
}
]
}
],
"note": [
{
"type": "violation",
"code": "routingOptionViolated",
"text": "startDirection"
}
],
"summary": {
"distance": 0,
"trafficTime": 0,
"baseTime": 0,
"flags": [
"tollroad"
],
"text": "The trip takes <span class=\"length\">0 m</span> and less than <span class=\"time\">1 min</span>.",
"travelTime": 0,
"_type": "RouteSummaryType"
}
}
],
"language": "en-us"
}
}
但是响应中返回的形状似乎不是链接的形状,即使开发人员指南提到参数“linkAttributes”可以用于获取链接形状。
如果我在这里做错了什么,请告知。另外,如果我可以使用另一个 API 来获得链接的形状。
我可以根据 link_id 进行 API 调用。