后端计算路线,Here-API 仅在地图上显示指导和路线 [英] Backend Calculated Route,Here-API to just show Guidance and route on Map
问题描述
我有一个完成路线计算的后端服务,我将使用 here-api 在地图上显示计算的路线并开始导航,我可以知道可以用于此目的的 API 吗?
I have a back-end service where the route calculation is done and I will be using here-api to display the calculated route on map and start guidance, Can I know the API which can be used for this purpose ?
我已经通过了,Here-API 我看到的地方
I have gone through, Here-API where I see
我们可以在重写的
onCalculateRouteFinished()
函数上从RouteResult
创建一个路由.
We can create an Route from
RouteResult
on OverriddenonCalculateRouteFinished()
function.
我们可以从列表中获取路线数据并创建一个MapObject
.
From the list we can get Route data and create a MapObject
.
使用此 MapObject
将其添加到地图中.
Using this MapObject
add this to the Map.
但这不是我的意图,因为我根本不会有路线数据.
But this is not my intention as I will not be having Route data at all.
使用地理坐标调用哪个 Here-api
以在地图中显示路线.
Which Here-api
to call with Geo-Coordinates to display the route b/w them in the map.
推荐答案
一般情况下,无法将路由从后端服务器(使用 HERE Routing API)传输到 HERE Mobile SDK.解决方法是:
In general it is not possible to transfer a route from a back end server (using HERE Routing API) to the HERE Mobile SDK. A workaround solution would be :
- 从 HERE Routing API 检索路线的形状.
- 简化此形状以减少坐标数.这里可能有不同的可能性,例如只使用机动的开始、中间、结束坐标而不是整个机动形状)
- 将简化的形状传递给您的应用
在应用中,使用HERE Mobile SDK函数CoreRouter重构路线.
- Retrieve the shape of the route from HERE Routing API.
- Simplify this shape to reduce the number of coordinates. There can be different possibilities here, for e.g use only start,middle,end coordinates of maneuvers instead of the whole maneuver shape )
- Pass the Simplified shape to you app
In the app , reconstruct the route using HERE Mobile SDK function CoreRouter.
calculateRoute(java.util.List<GeoCoordinate> routePoints, RouteOptions routeOptions, Router.Listener<java.util.List<RouteResult>,RoutingError> listener)
这篇关于后端计算路线,Here-API 仅在地图上显示指导和路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!