Skip to content
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

Reimplement current road name label atop navigator status/electronic horizon #1440

Closed
1ec5 opened this issue May 17, 2018 · 7 comments · Fixed by #3019
Closed

Reimplement current road name label atop navigator status/electronic horizon #1440

1ec5 opened this issue May 17, 2018 · 7 comments · Fixed by #3019
Assignees
Labels
bug Something isn’t working op-ex Refactoring, Tech Debt or any other operational excellence work. topic: cartography
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented May 17, 2018

#590 (comment) pointed out examples of the current road name label being unreliable, resulting in the user puck being off from the street source, failing to pick up the road name. A solid fix for this issue would require significant changes to the Directions API, but we do have opportunities to improve the quality of our vector tile–powered workaround:

  • The invisible line style layer that we query should vary in width the same way that the visible road layers vary in width: based on the zoom level and road class. A lot of the current unreliability is probably due to the invisible layer being only 1 pixel wide.
    streetLabelLayer.lineWidth = NSExpression(forConstantValue: 20)
  • For numbered roads, we should show the route number next to the road name (previously Don't use ceremonial name when way is interstate #291). A road feature’s ref attribute provides only the bare number in most cases, not the prefix or shield that we’re accustomed to from the Directions API. But we can use the shield and reflen attributes to get the shield image from the style and insert it into the label as part of an attributed string. The style images should already look pretty crisp at the size needed for that label.
  • I haven’t checked, but the upcoming Streets source v8 probably introduces some changes to the representation of road labels that could help us more straightforwardly determine the current road’s name.

/cc @mapbox/navigation-ios @danesfeder

@1ec5 1ec5 added bug Something isn’t working op-ex Refactoring, Tech Debt or any other operational excellence work. topic: cartography labels May 17, 2018
@1ec5
Copy link
Contributor Author

1ec5 commented May 21, 2018

The invisible line style layer that we query should vary in width the same way that the visible road layers vary in width: based on the zoom level and road class.

The line style layer isn’t really invisible: it just happens to be occluded most of the time by the road, landcover, and water layers. So we’ll need to ensure that the added line style layer is no wider than the existing layer for that road.

@vincethecoder vincethecoder self-assigned this Jul 2, 2018
@1ec5
Copy link
Contributor Author

1ec5 commented Jul 9, 2018

A lot of the current unreliability is probably due to the invisible layer being only 1 pixel wide.

Turns out #1076 quietly slipped in a fix for this issue. Now the line is 20 points wide. Not sure if that has improved the reliability at all.

A road feature’s ref attribute provides only the bare number in most cases, not the prefix or shield that we’re accustomed to from the Directions API. But we can use the shield and reflen attributes to get the shield image from the style and insert it into the label as part of an attributed string.

The Mapbox Streets source reference lists the valid shield values. Mapping them to Directions API refs would be a bit tricky, so for now let’s focus on using the shield values as-is to grab images out of the style using MGLStyle.image(forName:).

@1ec5
Copy link
Contributor Author

1ec5 commented Jul 24, 2018

Per mapbox/mapbox-navigation-android#1016 (comment), we can avoid false positives in the form of bike paths while driving by filtering the style layer by road class.

vincethecoder added a commit that referenced this issue Jul 24, 2018
…tails for textColor and fillColor for current road feature.
vincethecoder added a commit that referenced this issue Jul 24, 2018
vincethecoder added a commit that referenced this issue Jul 24, 2018
…tails for textColor and fillColor for current road feature.
vincethecoder added a commit that referenced this issue Jul 26, 2018
… Updated route map view controller to integrate the new changes in the highway shield struct.
vincethecoder added a commit that referenced this issue Jul 26, 2018
… Updated route map view controller to integrate the new changes in the highway shield struct.

Co-authored-by: Jerrad Thramer <[email protected]>
Co-authored-by: Vincent Sam <[email protected]>
vincethecoder added a commit that referenced this issue Jul 26, 2018
vincethecoder added a commit that referenced this issue Jul 30, 2018
…f text and image for road name label attachment. Refactor to retrieve the appropriate attachment for current shields on a road along the route.
vincethecoder added a commit that referenced this issue Jul 30, 2018
…the current polyline and multipolyline features. Updates to return the original full format of the rawValue init with HighwayShield.
vincethecoder added a commit that referenced this issue Jul 30, 2018
vincethecoder added a commit that referenced this issue Jul 31, 2018
@1ec5
Copy link
Contributor Author

1ec5 commented Jul 14, 2020

#2456 would add the current road name outside of turn-by-turn navigation using a more reliable source.

@stale
Copy link

stale bot commented Jan 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the archived Archived issue. label Jan 10, 2021
@1ec5 1ec5 removed the archived Archived issue. label Feb 11, 2021
@1ec5 1ec5 changed the title Improve content and reliability of current road name label Reimplement current road name label atop navigator status/electronic horizon Mar 22, 2021
@1ec5
Copy link
Contributor Author

1ec5 commented Mar 22, 2021

As of #2410, PassiveLocationDataSource posts a notification on each location update that contains the current road name, but only during free-driving, not during turn-by-turn navigation. This information is much more reliable than feature querying because it relies on map matching, which respects the road network’s topology unlike the map tiles.

During both free-driving and turn-by-turn navigation, the electronic horizon feature added in #2834 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.

@ShanMa1991
Copy link
Contributor

It's fixed in #3019 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working op-ex Refactoring, Tech Debt or any other operational excellence work. topic: cartography
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants