对编号是否有限制?我可以循环进行的HERE API调用数量(使用R)

问题描述 投票:0回答:1

我正在尝试遍历始发目的地和长途位置的列表,以获得运输时间。循环时出现以下错误。但是,当我进行单个调用(不循环)时,我得到的输出没有错误。我使用免费的HERE-API,每月可以进行25万笔交易。

 `for (i in 1:nrow(test))        
   { 
            call <- paste0("https://route.api.here.com/routing/7.2/calculateroute.json",
                           "?app_id=","appid",
                           "&app_code=","appcode",
                           "&waypoint0=geo!",y$dc_lat[i],",",y$dc_long[i],
                           "&waypoint1=geo!",y$store_lat[i],",",y$store_long[i],
                           "&mode=","fastest;truck;traffic:enabled",
                           "&trailerscount=","1",
                           "&routeattributes=","sh",
                           "&maneuverattributes=","di,sh",
                           "&limitedweight=","20")

                  response <-fromJSON(call, simplify = TRUE)
            Traffic_time = (response[["response"]][["route"]][[1]][["summary"]][["trafficTime"]]) / 60
            Base_time = (response[["response"]][["route"]][[1]][["summary"]][["baseTime"]]) / 60
            print(Traffic_time)
}`

Error in file(con, "r"): cannot open the connection to 'https://route.api.here.com/routing/7.2/calculateroute.json?app_id=appid&app_code=appcode&waypoint0=geo!45.1005200,-93.2452000&waypoint1=geo!45.0978500,-95.0413620&mode=fastest;truck;traffic:enabled&trailerscount=1&routeattributes=sh&maneuverattributes=di,sh&limitedweight=20' Traceback:

r here-api rjsonio
1个回答
0
投票

根据错误,这表明文件结尾处存在问题。它可能已损坏,最好尝试更改文件的扩展名。也可以尝试重新启动IDE。 API调用的数量取决于您为免费增值计划或专业计划选择的计划。您可以有更多详细信息:https://developer.here.com/faqs

© www.soinside.com 2019 - 2024. All rights reserved.