mapbox / mapbox/mapbox-navigation-ios

[Bug]: Reroute near final destination waypoint causes active route to skip remaining course and navigate to final destination

Open
#4,838 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
918
Forks
326
Avg merge
1h 16m
Merged PRs (30d)
3

Description

### Mapbox Navigation SDK version

3.25.0

### Steps to reproduce

I have a driving route with multiple explicit waypoints. Intermediate waypoints are configured as silent via points using `separatesLegs = false`, because the route should be presented as one continuous course, but the driver must still pass through the course points in order.

The active navigation route is created with `NavigationRouteOptions`, not `NavigationMatchOptions`:

```swift
let waypoints = coordinates.map {
Waypoint(coordinate: CLLocationCoordinate2D(latitude: $0.latitude, longitude: $0.longitude))
}

for index in waypoints.indices.dropFirst().dropLast() {
waypoints[index].separatesLegs = false
}

let routeOptions = NavigationRouteOptions(waypoints: waypoints, profileIdentifier: .automobile)
routeOptions.includesAlternativeRoutes = false

let routes = try await mapboxNavigation.routingProvider()
.calculateRoutes(options: routeOptions)
.value
```
Start active guidance with the resulting NavigationRoutes.

Then intentionally go off-route at a point where the wrong turn lands the driver on, or near, a later section of the same route/course. This is easiest to reproduce on loop-shaped courses or routes that pass near themselves.

### Expected behavior

When rerouting, the SDK should preserve all not-yet-reached via waypoints and continue guiding the driver through the remaining course in order.

In other words, if the driver has not actually passed waypoint N yet, the reroute should not skip waypoint N just because the driver’s current location is near a later part of the route geometry.

### Actual behavior

After rerouting, the route sometimes cuts short and skips one or more required silent waypoints. In some cases it appears to route toward the final destination / later route geometry rather than the next required course point.

This can also cause arrival/end-of-route behavior to occur earlier than expected, before the driver has completed the required course.

Most of the routes I create start and end at similar points.

### Is this a one-time issue or a repeatable issue?

repeatable

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with active guidance rerouting for routes created through NavigationRouteOptions and routingProvider(). Reproduce the loop-shaped route case with silent via points configured with separatesLegs = false, then trace how rerouting selects the next waypoint. Done means rerouting preserves every not-yet-reached waypoint in order and does not trigger arrival early.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.