Skip to content

feat: vehicle, avoid-point, waypoint and time options for requestRoutes - #25

Merged
mfazekas merged 1 commit into
mainfrom
feat/route-request-options
Oct 29, 2026
Merged

mfazekas merged 1 commit into
mainfrom
feat/route-request-options

Conversation

@mfazekas

@mfazekas mfazekas commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Adds the most requested Directions options to requestRoutes: vehicle dimensions (maxHeight, maxWidth, maxWeight), avoid points (excludePoints, sent together with exclude in the same Directions parameter), departAt/arriveBy, and per-waypoint silent (via points that don't split legs) and approach: 'curb'.

Android now gets the request as one HashMap that mirrors the dictionary iOS already gets, so new fields no longer change the JNI signature. Options the profile doesn't support, values out of range and a silent origin or destination now reject in JS with code: 'invalid_options'. Without that check the API ignores some of them, iOS drops others and Android sends them, so the platforms would behave differently.

departAt/arriveBy are YYYY-MM-DDThh:mm strings in local time at the origin/destination rather than Dates, because the iOS SDK always formats dates that way (in UTC, with no offset), so an absolute time can't be passed through. iOS avoid points use the SDK's @_spi(ExperimentalMapboxAPI) excludedLocations.

I tested each option on an iOS simulator and an Android emulator, comparing routes with and without it in Boston. Kenmore to MGH uses Storrow Drive by default. With maxHeight: 3.5, or an avoid point on Storrow, it takes Mass Ave and MA 3 instead (2814 m → 3500 m). maxWeight: 30 reroutes via Boylston Street. A silent via point gives 1 leg instead of 2. approach: 'curb' gives 1163 m → 1901 m. departAt at 03:00 vs 17:30 gives 762 s vs 1387 s. Both platforms returned the same routes as the Directions API called directly. maxWidth: 3 didn't change the route there.

@mfazekas
mfazekas force-pushed the feat/route-request-options branch from 4934aaf to d5d7e75 Compare October 29, 2026 05:45
@mfazekas
mfazekas marked this pull request as ready for review October 29, 2026 07:00
Adds maxHeight, maxWidth, maxWeight, excludePoints, departAt and arriveBy to
RouteRequestOptions, and silent and approach to waypoints. Android now gets
the request as one map, like the dictionary iOS gets, instead of positional
JNI arguments.
@mfazekas
mfazekas force-pushed the feat/route-request-options branch from d5d7e75 to c3d27de Compare October 29, 2026 07:47
@mfazekas
mfazekas merged commit 25e60eb into main Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant