-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose current way name during active navigation #2548
Comments
The newly implemented PassiveLocationManager provides this feature during free drive but we still don't have it during active nav. |
Here’s the implementation. It’s pretty involved. mapbox-navigation-ios/MapboxNavigation/RouteMapViewController.swift Lines 641 to 751 in 8687f33
Because it’s part of RouteMapViewController, an application that implements a custom UI is unable to take advantage of this implementation. This implementation is basically a giant workaround for the lack of reliable road name information in the Directions API response. (The response tells us the name of the road at the beginning of each step but doesn’t reflect any name changes between steps.) Even so, we should be able to expose a generic enough interface that we could swap in a more reliable source of road names in the future without breaking backwards compatibility. We’re also tracking some reliability improvements in the feature querying approach in the meantime: #1440.
There is already a Ideally, I think this piece of information would fit better in RouteStepProgress. PassiveLocationDataSource exposes it as part of a notification because there isn’t an analogous structure as part of passive navigation. However, feature querying requires access to a currently rendered map, so it would be supremely awkward for something like RouteMapViewController or even NavigationMapView to store state in a route progress model object that RouteController owns. Maybe in the meantime we can move this feature querying functionality into an extension of NavigationMapView, similar to the approach in #2535, and allow either RouteMapViewController or the application to call the method at the appropriate times.
This reflects the fact that, unfortunately, MapboxNavigationNative only provides this information during free driving. If the navigator were to provide this information when a route is set, then we could stash the road name in RouteStepProgress and there would be no need for feature querying. /cc @mapbox/navnative |
If this is still the case, we can fall back to the electronic horizon feature added in #2834, which posts a notification on each location update that contains the current road name and ref, among other information. This would be a shoe-in replacement for feature querying, except that the e-horizon notification does not include enough information to choose a route shield. So we probably would need to retain the feature querying step but use the e-horizon information to more reliably choose from among the feature querying results. That would allow us to remove the gangliest part of the feature querying code. |
#1440 tracks reimplementing the current road name label atop the information provided by PassiveLocationManager and electronic horizon notifications. That work is somewhat orthogonal to making the feature querying logic more reusable, but the two tasks would probably happen in tandem. |
#2902 broke out the logic for updating WayNameView so that it can be reused outside of NavigationViewController. Now that that’s out of the way, the simplest approach would be to make
While we’re at it, we could streamline the method to take a single location argument, pushing this coalescing expression up to the method’s callers:
|
@MaximAlien @ShanMa1991, do we need to expose anything additional so that custom UIs can populate a current road name view as easily as NavigationViewController does? |
I think we need to expose the shield related information. Because if we switch to use the Mapbox designed shield, we would deprecate the use of map feature query. If we don't provide the shield information, there won't be useful shield for the road labeling. |
The Mapbox-designed shield work in #1119 will completely remove the functionality described in #2548 (comment), so there’s no need to expose it publicly to developers in the meantime. |
The Nav SDK Example app has client side code in RouteMapViewController that utilizes map feature querying to deduce the current road name that the user is driving on. At present any Nav SDK customer needs to duplicate this code or invent another approach in order to calculate the current road name.
This should be something the SDK provides through the delegate pattern used for other nav updates.
Providing this as an abstraction through the SDK also allows us to swap out the implementation if we want to use a new feature of Nav Native or find a more performant way to calculate the road name.
The text was updated successfully, but these errors were encountered: