后端计算路线,此处API仅在地图上显示指导和路线 [英] Backend Calculated Route,Here-API to just show Guidance and route on Map

查看:146
本文介绍了后端计算路线,此处API仅在地图上显示指导和路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个进行路线计算的后端服务,我将使用here-api在地图上显示计算出的路线并开始导航,我是否知道可用于此目的的API?

我已经经历过,这里是我看到的API

  1. 我们可以在覆盖的onCalculateRouteFinished()函数上从RouteResult创建路由.

  2. 从列表中,我们可以获取Route数据并创建一个MapObject.

  3. 使用此MapObject将此添加到地图中.

但这不是我的意图,因为我根本不会拥有Route数据.

其中Here-api与地理坐标通话以在地图中显示其黑白路线.

解决方案

通常,无法将路由从后端服务器(使用HERE Routing API)传输到HERE Mobile SDK.解决方法是:

  1. 从HERE Routing API检索路线的形状.
  2. 简化此形状以减少坐标数.这里可能会有不同的可能性,例如,仅使用机动的开始,中间,结束坐标,而不是整个机动形状)
  3. 将简化形状传递给您的应用
  4. 在应用程序中,使用HERE Mobile SDK功能CoreRouter重构路线.

    calculateRoute(java.util.List<GeoCoordinate> routePoints, RouteOptions routeOptions, Router.Listener<java.util.List<RouteResult>,RoutingError> listener) 
    

  5. 使用来自回拨的导航用例的路线.

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 ?

I have gone through, Here-API where I see

  1. We can create an Route from RouteResult on Overridden onCalculateRouteFinished() function.

  2. From the list we can get Route data and create a MapObject.

  3. Using this MapObject add this to the Map.

But this is not my intention as I will not be having Route data at all.

Which Here-api to call with Geo-Coordinates to display the route b/w them in the map.

解决方案

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 :

  1. Retrieve the shape of the route from HERE Routing API.
  2. 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 )
  3. Pass the Simplified shape to you app
  4. 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) 
    

  5. Use the route from the call back for Navigation use case.

这篇关于后端计算路线,此处API仅在地图上显示指导和路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆