mapbox-navigation-ios icon indicating copy to clipboard operation
mapbox-navigation-ios copied to clipboard

Use speed limit from NavNative in turn-by-turn navigation

Open azarovalex opened this issue 3 years ago • 1 comments

Right now in the active navigation we use the speed limit from the Directions response: https://github.com/mapbox/mapbox-navigation-ios/blob/89708651afae2e98ec774d7d2e00c7773aa87fcc/Sources/MapboxCoreNavigation/RouteLegProgress.swift#L209-L236

It's better to migrate to the values returned by NavNative, because they may contain speed limits from the route graph even if the Directions response is missing these values.

azarovalex avatar Sep 23 '21 10:09 azarovalex

We can introduce a new private property to RouteStepProgress to indicate the current speed limit. RouteController would set it and this RouteLegProgress property would return its value. The existing implementation can be a fallback in case the property hasn’t been set. For example, this would allow an application to get the speed limit at an arbitrary location along the route by constructing a RouteLegProgress, without having to navigate there first. (That said, this implementation isn’t especially complex, so the application could just inline the logic and rely on MapboxDirections functionality for it.)

1ec5 avatar Sep 23 '21 18:09 1ec5