Android HERE: How to draw part of route

162 views Asked by At

I have calculated route for 10 waypoints. If i simply create new MapRoute it will draw full route from first to last waypoint. Is it possible to draw part of route, from first to second waypoint? I use 3.4.0.165 HERE SDK version. I have found this answer, but it for previous version.

I have tried to draw only first subleg in this way:

    int duration = route.getTta(Route.TrafficPenaltyMode.AVOID_LONG_TERM_CLOSURES, 0).getDuration();
    RouteElements routeElementsFromDuration = route.getRouteElementsFromDuration(0, duration);
    MapPolyline mapPolyline = new MapPolyline(routeElementsFromDuration.getGeometry());
    map.addMapObject(mapPolyline);

But when map tilt enabled polyline drawn somewhere above roads, and if i change scale polyline change position relative to map tile objects.

2

There are 2 answers

0
Zufar Muhamadeev On BEST ANSWER

Currently it is not possible, workaround - calculate route between each point and draw required part.

3
ishan05 On

Is there a reason you can't create a new route with your two waypoints? If you're using a stopover waypoint, you will be required to pass through the waypoint no matter what. Thus calculating the route between the first and second waypoint will provide you with the same route as the subset of the full route. If you're using a via waypoint, you can't count on drawing a subset of the route since it could change any minute given you are allowed to deviate away from the next waypoint at which point it will be ignored.