1

I'm currently working on a simple turn-by-turn Navigation App with the MapBox SDK. As default when the user goes off route and the route is recalculated the SDK does not consider U-turns to get to the old route. I wonder if there is a way to force U-turns anytime the user goes off route. It is necessary for my application to always use u-turns if a rerouting takes place. Maybe the OffRouteObserve could be a possible solution but I didn't have a clue on how to use this. I would be grateful for any help.

mapboxNavigation.requestRoutes(
            RouteOptions.builder()
                .applyDefaultNavigationOptions(DirectionsCriteria.PROFILE_WALKING)//TODO DirectionsCriteria.PROFILE_CYCLING
                .coordinatesList(listOf(originPoint,
                    testPoint1, testPoint2, testPoint3, testPoint4,
                    destination))
                .waypointIndicesList(listOf(0, 5)) //TODO 
                .build(),

That is my RouteOptions.builder() to calculate the initial route. I have tried the .bearings option, the .continueStraight and the .enableRefresh method but none of these options worked.

Amirali Eric Janani
  • 1,477
  • 3
  • 10
  • 20
theMule
  • 11
  • 2
  • U-turns are not always a legal option for a driver to make. – Magnas Apr 25 '23 at 04:26
  • Thanks for your reply. I know that U-turns are not always a legal option. I need the U-turns for a specific purpose. The users of the app are supposed to walk instead of driving a car. – theMule Apr 25 '23 at 15:05
  • Maybe recalculating a new route from the user’s location to the nearest point on your original route and then continue with the original route? – Magnas Apr 26 '23 at 05:56

0 Answers0