如何使用此处 API 从 link id 获取道路 link 数据
How to get roadlink data from link id using HERE API
给定一个 LinkId,我想使用 HERE REST API 检索相应的道路 link 数据。
我用路由API得到了道路link的坐标id(最近的道路link是return,这就是我想要的),但由于它是一条路线 API,它只是 return 这条道路 link 上的最近点,而不是实际道路 link 本身。我需要整条道路 link 几何图形,而且我不想指定图块和地图特定数据。
API 获取请求:https://route.api.here.com/routing/7.2/calculateroute.json?mode=fastest;car;traffic:enabled&routeAttributes=shape,incidents&departure=now&legAttributes=all&app_id={APP ID}&app_code={APP CODE}&waypoint0=57.69935469580243,11.987510919570923&waypoint1=57.69935469580243,11.987510919570923&linkAttributes=all&jsonAttributes=128&maneuverAttributes=all
产生:
{
"MetaInfo": {
...
},
"Route": [
{
"Waypoint": [
{
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
},
{
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
}
],
"Mode": {
...
},
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
"Leg": [
{
"Start": {
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
"End": {
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
"Maneuver": [
{
"Position": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
....
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
....
},
{
"Position": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
....
}
],
"Link": [
{
"LinkId": "+833889589",
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
....
},
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
....
}
如您所见,结果包含一个 LinkId(好),但只有一个点 link(坏)。我环顾四周,特别是交通流量 API,以及建议的平台数据扩展 API here。
您需要的有关 link ID 的几何信息可以从舰队远程信息处理高级数据集中检索。 HERE 地图数据的 LINK_FC1...5 层将为您提供给定地图区域中所有 link ID 的 link connectivity/geometry 信息。例如,给定一条道路 link ID,您可以得到 REF_NODE_NEIGHBOR_LINKS
和 NONREF_NODE_NEIGHBOR_LINKS
定义如下:
"REF_NODE_NEIGHBOR_LINKS": "Comma seperated list of LINK_IDs that are connected to this link via the reference node. If a LINK_ID is negative ('-') then this link is connected via it's non reference node.",
"NONREF_NODE_NEIGHBOR_LINKS": "Comma seperated list of LINK_IDs that are connected to this link via the non reference node. If a LINK_ID is negative ('-') then this link is connected via it's non reference node."
请通读 https://developer.here.com/documentation/platform-data/topics/request-constructing.html 中的文档。
给定一个 LinkId,我想使用 HERE REST API 检索相应的道路 link 数据。
我用路由API得到了道路link的坐标id(最近的道路link是return,这就是我想要的),但由于它是一条路线 API,它只是 return 这条道路 link 上的最近点,而不是实际道路 link 本身。我需要整条道路 link 几何图形,而且我不想指定图块和地图特定数据。
API 获取请求:https://route.api.here.com/routing/7.2/calculateroute.json?mode=fastest;car;traffic:enabled&routeAttributes=shape,incidents&departure=now&legAttributes=all&app_id={APP ID}&app_code={APP CODE}&waypoint0=57.69935469580243,11.987510919570923&waypoint1=57.69935469580243,11.987510919570923&linkAttributes=all&jsonAttributes=128&maneuverAttributes=all
产生:
{
"MetaInfo": {
...
},
"Route": [
{
"Waypoint": [
{
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
},
{
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
}
],
"Mode": {
...
},
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
"Leg": [
{
"Start": {
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
"End": {
"LinkId": "+833889589",
"MappedPosition": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
"OriginalPosition": {
"Latitude": 57.6993547,
"Longitude": 11.9875109
},
...
"Maneuver": [
{
"Position": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
....
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
....
},
{
"Position": {
"Latitude": 57.6992619,
"Longitude": 11.9864917
},
....
}
],
"Link": [
{
"LinkId": "+833889589",
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
....
},
"Shape": [
"57.6992619,11.9864917",
"57.6992619,11.9864917"
],
....
}
如您所见,结果包含一个 LinkId(好),但只有一个点 link(坏)。我环顾四周,特别是交通流量 API,以及建议的平台数据扩展 API here。
您需要的有关 link ID 的几何信息可以从舰队远程信息处理高级数据集中检索。 HERE 地图数据的 LINK_FC1...5 层将为您提供给定地图区域中所有 link ID 的 link connectivity/geometry 信息。例如,给定一条道路 link ID,您可以得到 REF_NODE_NEIGHBOR_LINKS
和 NONREF_NODE_NEIGHBOR_LINKS
定义如下:
"REF_NODE_NEIGHBOR_LINKS": "Comma seperated list of LINK_IDs that are connected to this link via the reference node. If a LINK_ID is negative ('-') then this link is connected via it's non reference node.",
"NONREF_NODE_NEIGHBOR_LINKS": "Comma seperated list of LINK_IDs that are connected to this link via the non reference node. If a LINK_ID is negative ('-') then this link is connected via it's non reference node."
请通读 https://developer.here.com/documentation/platform-data/topics/request-constructing.html 中的文档。