我正在尝试从此处api获取历史流量数据。我不确定我在R中是否具有正确的离开格式才能检索数据。我想要加利福尼亚的交通数据,但我居住在不同的州。
call <- paste0("https://route.api.here.com/routing/7.2/calculateroute.json",
"?app_id=","",
"&app_code=","",
"&waypoint0=geo!",34.13336,",",-117.416456,
"&waypoint1=geo!",33.727436,",",-117.784915,
"&mode=fastest;truck;traffic:enabled;",
"&departure=","2018-12-13T03:58:00-07")
#Testing URL Connection
GET(call)
response <-fromJSON(call, simplify = FALSE )
str(response)
#}
# parse response and get transit time
travel_time <- response[[1]]$route[[1]]$summary$travelTime
答案 0 :(得分:0)
您的问题有点含糊。让我们这样回答:
是的,时间格式正确。如果您选择在早上出发的时间,那么您将会有更多的流量,例如
您还将获得更长的旅行时间:
"summary": {
"distance": 73128,
"trafficTime": 3974,
"baseTime": 3737,
"flags": ["tollroad", "noThroughRoad", "motorway", "builtUpArea", "privateRoad"],
"text": "The trip takes <span class=\"length\">73.1 km</span> and <span class=\"time\">1:06 h</span>.",
"travelTime": 3974,
"_type": "RouteSummaryType"
}
一个一般性评论,请不要在任何论坛中发布您的凭据。以后再添加一些占位符即可。