如何从RESTAPI获取管线多段线
我正在开发一个应用程序,使用R中的Shiny和传单。我需要用REST API绘制路线图 我尝试使用以下方法获取多段线:如何从RESTAPI获取管线多段线,r,shiny,leaflet,here-api,R,Shiny,Leaflet,Here Api,我正在开发一个应用程序,使用R中的Shiny和传单。我需要用REST API绘制路线图 我尝试使用以下方法获取多段线: query <- paste0("&waypoint0=geo!", lat_usuario, ",", long_usuario, "&waypoint1=geo!", lat_of,
query <- paste0("&waypoint0=geo!",
lat_usuario,
",",
long_usuario,
"&waypoint1=geo!",
lat_of,
",",
long_of,
"&departure=", fecha,
"&mode=fastest;car;traffic:enabled")
paste0("https://route.api.here.com/routing/7.2/calculateroute.json",
"?app_id=", App_id, "&app_code=", App_code, query) %>%
RCurl::getURL(verbose = FALSE) %>%
RJSONIO::fromJSON() %>%
.[["response"]] %>%
.[["route"]] %>%
.[[1]] %>%
.[["leg"]] %>%
.[[1]] %>%
.[["maneuver"]] %>%
sapply("[[", "position") %>%
return()
我知道多段线不在街道内。如图所示:
如何在街道内绘制路线?由我自己解决
查询中的键是include“&routeAttributes=sh”。然后,我们接收路线的形状(以便能够绘制它们) 请澄清问题是否与Here API或您使用的工具/语言有关。如果是关于语言,那么我们建议您在标记中添加相关语言,以便语言专家可以帮助您。问题是关于API的。我不知道如何在地图上绘制路线布局。
leafletProxy("mapa", data = values$tabla) %>%
clearShapes() %>%
addPolylines(pol[2,], pol[1,], stroke=0.2)