我在一个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