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
Add support for congestion numeric attribute #3325
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good (with some NITs)
precondition(low.lowerBound >= 0, "Congestion level ranges can't include negative values.") | ||
precondition(low.upperBound <= moderate.lowerBound, "Values from the moderate congestion level range can't intersect with or be lower than ones from the low congestion level range.") | ||
precondition(moderate.upperBound <= heavy.lowerBound, "Values from the heavy congestion level range can't intersect with or be lower than ones from the moderate congestion level range.") | ||
precondition(heavy.upperBound <= severe.lowerBound, "Values from the severe congestion level range can't intersect with or be lower than ones from the heavy congestion level range.") | ||
precondition(severe.upperBound <= CongestionRangeSevere.upperBound, "Congestion level ranges can't include values greater than 100.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be correct if there's a gap between subsequent congestion levels? Should we instead verify if low.upperBound == moderate.lowerBound
? Otherwise it seems that it will treat those gaps as "unknown" congestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, what would be the use case for the gaps in intervals, but the "unknown" level of congestion for a value that you haven't defined for some reason looks semantically correct.
5305c20
to
585d9ec
Compare
585d9ec
to
410924d
Compare
410924d
to
e504f93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes mapbox/navigation-sdks#892.
Depends on mapbox/mapbox-directions-swift#575.
Based on discussions in the team, it's decided to make congestion numeric usage compatible with regular congestion levels.
For that reason, numeric values are matched to congestion levels using pre-defined ranges and then used as usual.
numericCongestionLevel
attribute over.congestionLevel
one inRouteLeg
.numericCongestionLevel
instead of.congestionLevel
inNavigationRouteOptions