mapbox / mapbox/mapbox-navigation-android
driving-traffic ends route early and snaps destination to a larger road instead of the final local road
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Description
**Android API:** 29~36
**Mapbox Navigation SDK version:** 3.21.0-rc.1
### Steps to trigger behavior
1. Request a route with the `driving-traffic` profile to a destination that is reachable via a narrow local/public road near the destination.
2. Use a destination around Shakujii Shrine, Nerima, Tokyo, Japan, or another similar case where the destination is slightly off the main road and the final access is via a local street.
3. Compare the result of `driving-traffic` with `driving` for the same origin/destination.
4. Observe that with `driving-traffic`, the route ends on a larger road before the destination and arrival is announced early. With `driving`, the route continues onto the local road and reaches much closer to the destination.
#### Example
from: 139.619976,35.765228
to: 139.603026,35.747831
https://docs.mapbox.com/playground/directions/?coordinates=139.619976%2C35.765228&coordinates=139.603026%2C35.747831&profile=driving-traffic
### Expected behavior
`driving-traffic` should still route onto the final drivable local road near the destination when that road is publicly accessible and routable, while using traffic-aware weighting on the major parts of the route.
In other words, traffic awareness should not cause the destination waypoint to be snapped to a larger road significantly before the actual reachable destination if a valid final local-road approach exists.
### Actual behavior
With `driving-traffic`, the destination is snapped to a larger road before the destination, and the route ends early instead of entering the final local road.
In our case, the route line ends roughly 100m before the destination, and navigation effectively finishes there. The local road is visible on the map and is a normal public road, not private property or an indoor/internal road.
For the same origin/destination, `driving` produces a route that follows the final local road and reaches much closer to the destination.
This makes `driving-traffic` unusable for destination accuracy in these cases, because arrival is reported too early even though vehicle access via the final local street exists.
### Minimal code
```kotlin
val routeOptions = RouteOptions.builder()
.applyDefaultNavigationOptions(DirectionsCriteria.PROFILE_DRIVING_TRAFFIC)
.applyLanguageAndVoiceUnitOptions(context)
.coordinatesList(listOf(origin, destination))
.build()
mapboxNavigation.requestRoutes(
routeOptions,
object : NavigationRouterCallback {
override fun onRoutesReady(
routes: List,
routerOrigin: String,
) {
// draw route
}
override fun onFailure(
reasons: List,
routeOptions: RouteOptions,
) = Unit
override fun onCanceled(
routeOptions: RouteOptions,
routerOrigin: String,
) = Unit
},
)
```
### Notes
- This reproduces consistently, not just at one destination.
- The problem appears with driving-traffic; switching to driving improves the final approach.
- Tightening the destination radiuses value (for example 10m) often results in NoSegment, which suggests that the driving-traffic profile is not considering the final local road as a valid routable endpoint in these cases.
- According to the Directions API docs, returned waypoints are snapped to the road network. In this case, the snapping result for driving-traffic appears too aggressive and prefers a larger road over the valid final local road.
- I can attach screenshots showing:
- driving-traffic route ending early on the main road
- driving behaving closer to the expected result than driving-traffic
| driving-traffic | driving |
| - | - |
| |
|
### Question
Is this expected behavior for driving-traffic?
If so, is there any supported way to make driving-traffic keep traffic-aware routing on major roads while still using the final valid local road near the destination instead of snapping arrival to a larger road too early?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Kotlin requestRoutes example using the supplied origin, destination, and driving-traffic profile, then compare it with driving and the documented destination-radius behavior. Verify whether the final local road is considered routable and whether the traffic profile changes waypoint snapping; done means determining whether this is expected behavior or identifying a supported configuration or SDK issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100