[英]How to find geometry/shape of a Here Maps Link Id
我有一个 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 电话。
航路点用于定义路线必须 go 通过的 map 上的位置。 航路点可以是 StopOver(例如,起点或目的地)或 PassThrough。 有效的 CalculateRoute 请求必须包含至少两个 StopOver 航路点。 可以通过三种方式为航线分配航路点
因为您使用的是链接位置,所以让我关注第三点。 请注意,NavigationWaypointParameter 通过 LinkId 和可选的 Spot 值定义航路点。 Spot 被定义为从链接的参考节点到非参考节点的分数距离,其值介于 0 和 1 之间。当请求中没有给出 Spot 值或 DisplayPosition 时,则假定默认值为 0.5
航点的可选显示 position 定义位置显示在 map 上的位置。它表示位置的中心并且不可导航,它不位于 routing.network 中的链接上,与位置的导航位置相反. 显示 position 允许路由引擎决定航路点是位于路线的左侧还是右侧。
这是文档中的示例:
// using exact link information with display position and spot: &waypoint0=link.37,7914050.-122,3987030.-743460791:0,8996 // using exact link information with display position and spot and additional stopover delay of 5 minutes. &waypoint0=link,stopOver.300,37.7914050:-122,3987030.-743460791,0.8996 // the display position is optional: &waypoint0=link.,-743460795.0;1342 &waypoint0=link,-743460795.0:1342 // using user label; &waypoint0=link:37.7914050,-122.3987030;My Home!-743460791,0.8996 // using user label without display position: &waypoint1=link!;My Work!-743460795 // link traveled in any direction: &waypoint0=link!*743460795
由于请求中的链接参数对于路点 0 和路点 1 是相同的,因此仅返回该点。 但是,如果您设置 spot 为例,链接将显示如下: https://refclient.ext.here.com/#url=https://route.api.here.com/routing/7.2/calculateroute。 json?routeattributes=sh,gr&mode=fastest;car&maneuverattributes=po,ti,pt,ac,di,fj,ix&language=en-us&jsonattributes=41&metricsystem=metric&waypoint0=link,stopOver.-893783351,0.1342&waypoint1=link!stopOver!-893783351&app_code =kg72HCGA7Um5GdCdXRp5mw&app_id=wkkI0nFlieJAZT1KrbpW
但是,如果您正在寻找特定于链接 ID 的详细信息,您可以使用 PDE 请求,如下所述: https://tcs.ext.here.com/examples/v3/pde_get_any_link_info
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.