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

Traffic congestion colors are misplaced and smeared along the route line #2574

Closed
1ec5 opened this issue Aug 27, 2020 · 2 comments · Fixed by #2580
Closed

Traffic congestion colors are misplaced and smeared along the route line #2574

1ec5 opened this issue Aug 27, 2020 · 2 comments · Fixed by #2580
Assignees
Labels
bug Something isn’t working release blocker Needs to be resolved before the release.
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented Aug 27, 2020

NavigationMapView.generateTrafficGradientStops(for:) seems to be calculating incorrect stops for the gradient that colors the route line according to traffic congestion. To the end user, it would seem like the route line has random splotches of red and yellow that don’t look like traffic congestion and don’t correspond to real-world conditions.

The following examples are in the vicinity of 39.2872°N, −84.4656°W near Tri-County Mall in Springdale, Ohio, comparing the example application running navigation SDK v1.0.0-rc.1 with map SDK v6.0.0 against a webpage running mapbox/mapbox-gl-directions#145 (which is based on v4.0.0).

kemper

tri-county

The inaccuracy is more apparent when getting a multileg route in the example application: the segments move considerably between a given single-leg route and a multileg route that includes it. These screenshots were taken within a few seconds of each other; the inconsistency reproduces reliably:

2 3

This regression was introduced in #2377. It’s possible that the refactoring suggested in #2423 would improve the situation.

/cc @mapbox/navigation-ios

@1ec5 1ec5 added the bug Something isn’t working label Aug 27, 2020
@1ec5 1ec5 added this to the v1.0.0 milestone Aug 27, 2020
@1ec5
Copy link
Contributor Author

1ec5 commented Aug 27, 2020

NavigationMapView.generateTrafficGradientStops(for:) hard-codes the first leg, which seems incorrect:

guard let congestionSegments = addCongestion(to: route, legIndex: 0) else { return }

In the past, legs other than the “current” leg would’ve been dimmed and shown no traffic congestion segments. This method only uses the leg index to set the MBCurrentLegAttribute (isCurrentLeg) on each leg’s polyline feature, but the code that adjusted the color based on this attribute has been deleted, so nothing looks at this 0 anyways.

@1ec5
Copy link
Contributor Author

1ec5 commented Aug 27, 2020

generateTrafficGradientStops(for:) iterates over each leg’s line feature but writes the stops into a single NavigationMapView.routeGradientStops property on every iteration. That property only stores a single stop dictionary for each colored layer, effectively commingling the stops for each of the legs along the route.

routeGradientStops.line[segmentEndPercentTraveled.nextDown] = associatedCongestionColor

@zugaldia zugaldia added the release blocker Needs to be resolved before the release. label Aug 27, 2020
@MaximAlien MaximAlien self-assigned this Aug 27, 2020
@1ec5 1ec5 changed the title Route line displays inaccurate, inconsistent traffic congestion Traffic congestion colors are misplaced and smeared along the route line Aug 28, 2020
@MaximAlien MaximAlien linked a pull request Aug 31, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working release blocker Needs to be resolved before the release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants