I need to show the Trip route on the map. To calculate a route based on an imported GeoCoordinates list, I've used the HERE SDK's OfflineRoutingEngine class. The problem is that the route returned by the calculateRoute function resembles a combination of all routes connected. Could someone please help me identify the problem with the code here?
List<Waypoint> waypoints = new ArrayList<>();
waypoints.add(new Waypoint(routePoints.get(0)));
for (int i = 1; i < routePoints.size() - 1; i++) {
Waypoint wp = new Waypoint(routePoints.get(i));
wp.type = WaypointType.PASS_THROUGH;
waypoints.add(wp);
}
waypoints.add(new Waypoint(routePoints.get(routePoints.size() - 1)));
mOfflineRoutingEngine.calculateRoute(waypoints, new CarOptions(), (routingError, routes) -> {
if (routingError != null) {
Log.d(TAG, "showRoute(): Error while calculating a route");
return;
}
// When routingError is null, routes is guaranteed to contain at least one route
if ((routes != null) && (routes.size() > 0)) {
Route route = routes.get(0);
if (mRoutePolyline == null) {
Log.d(TAG, "showRoute(): addPolyline");
// shows routes
mRoutePolyline = new MapPolyline(route.getGeometry(), ROUTE_LINE_WIDTH, mRouteColor);
mMapView.getMapScene().addMapPolyline(mRoutePolyline);
} else {
Log.d(TAG, "showRoute(): updatedPolyline");
// update route
mRoutePolyline.setGeometry(route.getGeometry());
}
} else {
Log.d(TAG, "showRoute(): Error while calculating a route");
}
});
I'm getting the following result as a geometry of a route: enter image description here