mapbox / mapbox/mapbox-navigation-ios
Feature Request: Public API to construct NavigationRoutes from an existing Directions API response
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 918
- Forks
- 326
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 3
Description
Summary
The current public Navigation SDK v3 API appears to require applications to obtain NavigationRoutes by calling MapboxRoutingProvider.calculateRoutes().
For applications using a server-authoritative routing architecture, this requires a second Directions calculation on the device.
We need a supported public API that allows an application to start navigation from an already existing Mapbox Directions API response generated by a backend.
Backend
│
▼
Mapbox Directions API
│
▼
Backend evaluates alternatives
│
▼
Backend selects one exact route
At this point we would like to pass the complete Directions response to the iOS Navigation SDK.
Desired workflow
Backend
│
▼
Mapbox Directions API
│
▼
Backend selects one route
│
▼
Complete Directions response sent to iOS
│
▼
Navigation SDK constructs NavigationRoutes
│
▼
startActiveGuidance(...)
without performing another Directions request.
Current limitation
We found:
NavigationRoutes(
routeResponse: RouteResponse,
routeIndex: Int,
responseOrigin: RouterOrigin
)
but it appears to be available only through:
@_spi(MapboxInternal)
which is not appropriate for production applications.
The documented public API appears to require:
MapboxRoutingProvider.calculateRoutes(...)
which performs another Directions request and may produce a different route set.
Why this matters
Many enterprise navigation applications perform routing on a backend for reasons such as:
- route optimization
- policy enforcement
- predictive routing
- fleet coordination
- logistics
- server-side decision making
The mobile application should be able to guide the user along the exact backend-selected route rather than initiating another route calculation.
Feature request
Please consider exposing a supported public API that allows developers to:
- construct NavigationRoutes from an existing Mapbox Directions API response,
- specify the selected route index,
- start or replace active guidance,
- avoid another Directions request.
If this capability already exists through a supported public API, could you please point us to the relevant documentation?
Environment
- Navigation SDK for iOS 3.23.1
- Maps SDK 11.23.1
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 by tracing the public NavigationRoutes(routeResponse:routeIndex:responseOrigin:) initializer and the @_spi(MapboxInternal) boundary. Compare that path with MapboxRoutingProvider.calculateRoutes(...) and the startActiveGuidance(...) entry point. Done means a supported public workflow can consume the existing Directions response, select a route, and begin guidance without another request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- api, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100