给定一个链接,我想使用此处的REST API检索相应的道路链接数据。
我已经使用了路由API获取坐标的路链ID(最接近的道路链接是返回,这是我想要的(,但是由于它是路由API,不是实际的道路链接本身。我需要整个道路链接几何形状,我不必指定图块并映射特定数据。
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"
],
....
}
如您所见,结果包含一个链接(好(,但该链接上只有一个点(糟糕(。我环顾四周,特别是在此处建议的流量流API和平台数据扩展API。
您需要的几何信息可以从车队远程信息处理高级数据集中检索。link_fc1 ... 5层的图层数据将为您提供给定地图区域中所有链接ID的链接连接/几何信息。例如,给定路链路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。