可以使用calculateroute.json在android sdk中进行路由

可以使用calculateroute.json在android sdk中进行路由,android,here-api,here-maps-rest,Android,Here Api,Here Maps Rest,我在android项目中使用的是Here maps SDK。 我想计算轨迹并将其放入android地图中,以完全按照这种方式进行路由(在API上计算) 我试图从Json中获取点并将它们映射到航路点,但计算方法有时与原始方法不同 到目前为止,我所尝试的: 1. Get calculateroute.json from https://route.api.here.com/routing/7.2/calculateroute.json 2. Put coordinates to RoutePla

我在android项目中使用的是Here maps SDK。 我想计算轨迹并将其放入android地图中,以完全按照这种方式进行路由(在API上计算)

我试图从Json中获取点并将它们映射到航路点,但计算方法有时与原始方法不同

到目前为止,我所尝试的:

1. Get calculateroute.json from 
https://route.api.here.com/routing/7.2/calculateroute.json

2. Put coordinates to RoutePlan

RoutePlan plan = new RoutePlan();
plan.addWaypoint(new RouteWaypoint(new GeoCoordinate(54.3782893, 18.7009037, 0), RouteWaypoint.Type.STOP_WAYPOINT));
plan.addWaypoint(new RouteWaypoint(new GeoCoordinate(54.2660919, 18.6583687, 0), RouteWaypoint.Type.STOP_WAYPOINT));

3. Calculate route and put to a map 

new CoreRouter().calculateRoute(plan, new CoreRouter.Listener() {
    @Override
    public void onCalculateRouteFinished(List<RouteResult> list, RoutingError error) {
        MapRoute mapRoute = new MapRoute(list.get(0).getRoute()
        new Map().addMapObject(mapRoute)
    }

}


基本上没有直接的方法来实现这一点,解决方案如线程中所述:

基本上没有直接的方法来实现这一点,解决方案如线程中所述:

1. Get calculateroute.json from 
https://route.api.here.com/routing/7.2/calculateroute.json

2. Create MapRoute from the calculateroute.json result ( but don't calculate it )

3. Put MapRoute to map and start navigation