Repository navigation
feat: Map Matching and custom routes - #27
Merged
Merged
Conversation
mfazekas
marked this pull request as ready for review
October 28, 2026 12:52
mfazekas
force-pushed
the
feat/map-matching
branch
from
October 29, 2026 00:15
7b3beae to
6139f62
Compare
Follow an app-supplied path: Map Matching through NavigationMatchOptions on iOS and requestMapMatching on Android, returning the same Route host objects as requestRoutes. setRerouteEnabled turns rerouting of Directions routes off.
…ed timing The iOS SDK drops the further pieces of a split match instead of returning them as alternatives, so detect the split from the main route ending before the last tracepoint.
Android's simulated guidance misses an intermediate waypoint at the Pier 39 junction, also on a requestRoutes route, so the example stops where simulation works on both platforms.
mfazekas
force-pushed
the
feat/map-matching
branch
from
October 29, 2026 01:25
6139f62 to
75ae5e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets apps guide along a route they define, such as a tour, a delivery run or a fleet route, instead of one Directions picks. This is item R3 in the API gap report and the most-requested feature in the unofficial packages (homee #24 and #48, pawan-pk #20 and #29, uju777 #32). It also covers the part of R4 that matters here: turning rerouting off.
The returned
Routeworks unchanged withpreviewRoute,startActiveGuidanceand<NavigationView route>. The C++ bindings get arequestMatchedRoutesplatform call next torequestRoutes, and the two share one response resolver.Platform notes:
routingProvider().calculateRoutes(options: NavigationMatchOptions).waypointIndicesmaps toWaypoint.separatesLegs, andradiusesmaps tocoordinateAccuracy.MapboxNavigation.requestMapMatching, which the SDK marks@ExperimentalPreviewMapboxNavigationAPI; the TypeDoc says so. It asks for banner and voice instructions, roundabout exits and annotations to roughly match iOS.code: 'no_single_match'on both platforms. On iOS the SDK silently drops the extra pieces, so we detect a split when the main route ends before the last matched tracepoint.setRerouteEnabledis for Directions routes. Android applies it at once, also mid-guidance. iOS reads it only when the navigation session is created (the first route request or guidance start); a later change has no effect and logs a warning. The TypeDoc and README say this.Decisions applied: keep rejecting split matches with
no_single_match; keepsetRerouteEnabledas is with the iOS timing documented, and noconfigure()API.Verified on the iOS simulator (iPhone 17) and the Android emulator, both platforms for each step, in the example's "Matched route" screen plus a local harness (not committed) for the live, gap and reroute cases:
simctl location start,adb emu geo fix):offRouteturns true, no route change, then false, and progress resumes.setRerouteEnabled(false)set before the first request, no reroute on either platform. On Android, turning it off mid-guidance also stops reroutes. A control run with rerouting on rerouted at once. On iOS a later call logs the warning.no_single_match. A trace with an unmatchable jump rejects withroute_request_failed. Neither crashes.Changes since the prototype: iOS now detects split matches (the prototype resolved with only the first piece). The
setRerouteEnableddocs were clarified. The example now stops at Pier 29 instead of Pier 39: Android's simulated guidance misses an intermediate waypoint at the Pier 39 junction and stalls off route. ArequestRoutesroute with a via point there does the same, and live guidance through it works, so it's an SDK replay issue, not a Map Matching one.Limitations:
no_single_matchcheck relies on the SDK keeping all tracepoints inNavigationRoutes.waypoints.Out of scope: a
directionsBaseUrlsetting (the iOS endpoint override is@_spi(MapboxInternal)), and raw Directions JSON →Route(Android 3.33 keepsNavigationRoute.createinternal).Possible follow-ups: waypoint names, timestamps and
tidy, all supported by both SDKs;datasetProfileIdentifiermatching the request profile on iOS for walking and cycling (requestRouteshas the same gap).