简体   繁体   English

如何找到 Here Maps 链接 ID 的几何形状/形状

[英]How to find geometry/shape of a Here Maps Link Id

I have a list of Here Maps link Ids.我有一个 Here Maps 链接 ID 列表。 I want to get their geometries.我想得到他们的几何图形。 I tried calling v7 calculateroute REST API, passing a single link_id in waypoint0 and waypoint1 as below,我尝试调用 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"
    }
}

But the shape returned in the response doesn't seem to be the shape of the link, even though the developer guide mentions that the parameter "linkAttributes" can be used to get the link shape.但是响应中返回的形状似乎不是链接的形状,尽管开发人员指南提到参数“linkAttributes”可用于获取链接形状。

Please advise if I am doing anything wrong here.如果我在这里做错了什么,请告知。 Also, if I can use another API to get shape of a link.另外,如果我可以使用另一个 API 来获得链接的形状。

I am fine with making an API call per link_id.我可以为每个 link_id 拨打 API 电话。

A waypoint is used to define the locations on the map that the route must go through.航路点用于定义路线必须 go 通过的 map 上的位置。 A waypoint can be either a StopOver (for example, start or destination) or a PassThrough.航路点可以是 StopOver(例如,起点或目的地)或 PassThrough。 A valid CalculateRoute request must include at least two StopOver waypoints.有效的 CalculateRoute 请求必须包含至少两个 StopOver 航路点。 There are three ways to assign waypoints for the route可以通过三种方式为航线分配航路点

  1. a rough position: GeoWaypointParameterType粗略的 position: GeoWaypointParameterType
  2. a reference to a street: NavigationWaypointParameter with StreetPositions对街道的引用:NavigationWaypointParameter with StreetPositions
  3. an exact reference to a link: NavigationWaypointParameter with LinkPositions对链接的精确引用:带有 LinkPositions 的 NavigationWaypointParameter

The details can be found here: https://developer.here.com/documentation/routing/dev_guide/topics/resource-param-type-waypoint.html#resource-param-type-waypoint__geo-waypoint详情可以在这里找到: https://developer.here.com/documentation/routing/dev_guide/topics/resource-param-type-waypoint.html#resource-param-type-waypoint__geo-waypoint

Let me focus on 3rd point since you are using Link positions.因为您使用的是链接位置,所以让我关注第三点。 Please note that the NavigationWaypointParameter defines a waypoint by LinkId and optional Spot value.请注意,NavigationWaypointParameter 通过 LinkId 和可选的 Spot 值定义航路点。 Spot is defined as the fractional distance from the link's reference-node to the non-reference node, with a value between 0 and 1. When no Spot value nor DisplayPosition is given in request then default value 0.5 is assumed Spot 被定义为从链接的参考节点到非参考节点的分数距离,其值介于 0 和 1 之间。当请求中没有给出 Spot 值或 DisplayPosition 时,则假定默认值为 0.5

The optional display position of the waypoint defines where the location is displayed on a map. It denotes the center of the location and is not navigable, it is not located on a link in the routing.network in contrast to the navigation positions of a location.航点的可选显示 position 定义位置显示在 map 上的位置。它表示位置的中心并且不可导航,它不位于 routing.network 中的链接上,与位置的导航位置相反. The display position allows the routing engine to decide whether the waypoint is located on the left or on the right-hand side of the route.显示 position 允许路由引擎决定航路点是位于路线的左侧还是右侧。

Here is the example from the documentation:这是文档中的示例:

 // 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

Since the link parameter in the request is same for waypoint 0 and waypoint 1, only the point is returned.由于请求中的链接参数对于路点 0 和路点 1 是相同的,因此仅返回该点。 However, if you set spot for example, the link will be shown as below: 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但是,如果您设置 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

在此处输入图像描述

But if you are looking for details specific to the link ID, you can use PDE request as explained here: https://tcs.ext.here.com/examples/v3/pde_get_any_link_info但是,如果您正在寻找特定于链接 ID 的详细信息,您可以使用 PDE 请求,如下所述: https://tcs.ext.here.com/examples/v3/pde_get_any_link_info

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM