Fleet Telematics路线匹配,为每个路线链接查询更多属性

时间:2019-02-12 06:59:49

标签: here-api

我正在评估Fleet Telematics路线匹配服务,并且尝试在响应中直接检索更多链接属性。如何实现?

我在HERE.com上创建了一个免费增值帐户,并尝试了https://developer.here.com/documentation/route-match/topics/quick-start-gps-trace-route.html文档中的基本示例。 在该服务的文档中,我发现应该可以获取有关响应中返回的路由链接的更多属性:https://developer.here.com/documentation/route-match/topics/attributes-along-route.html

以下作品(当然123不是我的真实应用ID,也不是我的真实应用代码):

curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D"

并返回:

{"RouteLinks":[{"linkId":25664478,"functionalClass":5,"confidence":1.0,"shape":"51.10168 0.39385 51.10184 0.39329","offset":0.62907,"mSecToReachLinkFromStart":2614,"linkLength":43.08},{"linkId":1022687683,"functionalClass":4,"confidence":1.0,"shape":"51.10184 0.39329 51.10214 0.39345","mSecToReachLinkFromStart":8376,"linkLength":35.21},{"linkId":1022687684,"functionalClass":4,"confidence":1.0,"shape":"51.10214 0.39345 51.10224 0.3935","mSecToReachLinkFromStart":10284,"linkLength":11.66},{"linkId":25664459,"functionalClass":4,"confidence":1.0,"shape":"51.10224 0.3935 51.10232 0.39354","mSecToReachLinkFromStart":11811,"linkLength":9.33},{"linkId":781742854,"functionalClass":4,"confidence":1.0,"shape":"51.10232 0.39354 51.10245 0.39361 51.10255 0.39367","mSecToReachLinkFromStart":16214,"linkLength":27.16},{"linkId":781742855,"functionalClass":4,"confidence":1.0,"shape":"51.10255 0.39367 51.10269 0.39376","mSecToReachLinkFromStart":16255,"linkLength":16.8},{"linkId":25664450,"functionalClass":4,"confidence":1.0,"shape":"51.10269 0.39376 51.10292 0.39391 51.10306 0.39401","mSecToReachLinkFromStart":19004,"linkLength":44.74},{"linkId":25664444,"functionalClass":4,"confidence":1.0,"shape":"51.10306 0.39401 51.10324 0.39413","mSecToReachLinkFromStart":29879,"linkLength":21.72},{"linkId":25664440,"functionalClass":4,"confidence":1.0,"shape":"51.10324 0.39413 51.10335 0.3942 51.1035 0.39431 51.1036 0.39439","mSecToReachLinkFromStart":37082,"linkLength":44.02},{"linkId":25664427,"functionalClass":4,"confidence":1.0,"shape":"51.1036 0.39439 51.10369 0.39446 51.10378 0.39453","mSecToReachLinkFromStart":40731,"linkLength":22.3},{"linkId":860272608,"functionalClass":4,"confidence":1.0,"shape":"51.10378 0.39453 51.10394 0.39465","mSecToReachLinkFromStart":43951,"linkLength":19.68},{"linkId":860272609,"functionalClass":4,"confidence":1.0,"shape":"51.10394 0.39465 51.10417 0.39482","mSecToReachLinkFromStart":44659,"linkLength":28.22},{"linkId":781742870,"functionalClass":4,"confidence":1.0,"shape":"51.10417 0.39482 51.10427 0.39489 51.10439 0.39497 51.10452 0.39505 51.10463 0.39512","mSecToReachLinkFromStart":48568,"linkLength":55.33},{"linkId":1022687692,"functionalClass":4,"confidence":1.0,"shape":"51.10463 0.39512 51.10483 0.39523","mSecToReachLinkFromStart":57622,"linkLength":23.55},{"linkId":1022687693,"functionalClass":4,"confidence":1.0,"shape":"51.10483 0.39523 51.10547 0.39554","offset":0.28475,"mSecToReachLinkFromStart":64944,"linkLength":74.44}],"TracePoints":[{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10177,"latMatched":51.10178,"linkIdMatched":25664478,"lon":0.39349,"lonMatched":0.3935,"matchDistance":1.46,"matchOffsetOnLink":0.6290743846692971,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10181,"latMatched":51.10182,"linkIdMatched":25664478,"lon":0.39335,"lonMatched":0.39336,"matchDistance":1.46,"matchOffsetOnLink":0.8790743846674338,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":22.0,"lat":51.10255,"latMatched":51.10255,"linkIdMatched":781742855,"lon":0.39366,"lonMatched":0.39367,"matchDistance":1.11,"matchOffsetOnLink":0.0,"minError":1.0,"routeLinkSeqNrMatched":5,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":25.0,"lat":51.10398,"latMatched":51.10398,"linkIdMatched":860272609,"lon":0.39466,"lonMatched":0.39468,"matchDistance":1.87,"matchOffsetOnLink":0.1535150210712758,"minError":1.0,"routeLinkSeqNrMatched":11,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":17.0,"lat":51.10501,"latMatched":51.10501,"linkIdMatched":1022687693,"lon":0.39533,"lonMatched":0.39532,"matchDistance":1.33,"matchOffsetOnLink":0.2847498087963734,"minError":1.0,"routeLinkSeqNrMatched":14,"* Connection #0 to host rme.cit.api.here.com left intact speedMps":0.0,"timestamp":0}],"Warnings":[],"MapVersion":"LATEST"}

但是,到目前为止,我尝试获取有关道路链接的更多属性的尝试尚未成功。无论我选择哪个属性,以下查询均不起作用:

curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ID"

我没有得到正确的回应,

{"faultCode":"6a8a9966-b2eb-4a54-8f58-2f36e501bb94","responseCode":"400 Bad Request","message":"Invalid layer attribute parameter."}

使用图层代替属性也不起作用:

curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ATTRIBUTE_FC5"

这将返回与上面相同的错误。

基于文档,我希望可以通过某种方法直接在响应中检索更多链接属性,但是我无法弄清楚该怎么做。显然,我一定做错了事。

1 个答案:

答案 0 :(得分:0)

请参考以下链接

https://developer.here.com/documentation/route-match/topics/resource-matchroute-request.html

您可以使用以下命令轻松检索特定图层的属性,其中attributes参数应为LINK_ATTRIBUTE_FCn(*)。也可以使用LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE,RAMP,URBAN)从这些属性中检索特定信息。

df <- data.frame(
  StuID=c("112", "113", "114", "115", "116", "117"), 
  CLASSID=c("123B542", "123B542", "458Z84", "458Z84", "760E53", "760E53")
)  

类似地,您可以获取其他图层的属性(即ROAD_GEOM_FCn(*))

希望这对您有所帮助。

最好的问候,

Jeyaprakash Rajagopal