-
Notifications
You must be signed in to change notification settings - Fork 88
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
Serialize speed limit annotations #250
Conversation
The saga continues in #367. |
I revived this PR because it already had tests and handled Autobahns correctly, unlike #367. |
To do before merging:
|
Add support for speed limits via maxspeed annotations.
The SPM build is failing with:
which is weird, because I just merged in #379, which requires macOS 10.12 and above. |
SPM doesn't depend on Xcode, it has its own place to specify supported platforms which I took the liberty of adding to this PR here. |
Ideally MapboxDirections.swift would be responsible for cleaning up the model so that the speed limit attributes are readily usable in UI. Unfortunately, it’s a challenge to associate attributes with steps. Currently the navigation SDK associates congestion attributes with steps, but that’s memory intensive and a lot of inconvenient code. |
87ee659 introduces a new property, let distanceTraveled = legProgress.currentStepProgress.distanceTraveled
let index = legProgress.currentStep.shape!.indexedCoordinateFromStart(distance: distanceTraveled).index
// or: let index = legProgress.currentStep.shape!.closestCoordinate(to: coordinate)!.index
let legProgress = routeProgress.currentLegProgress
let range = legProgress.leg.segmentRangesByStep[legProgress.stepIndex]
let speedUnit = legProgress.currentStep.speedLimitUnit!
let speedLimit = legProgress.leg.segmentMaximumSpeedLimits[range][index].converted(to: speedUnit)
let speedLimitSignStandard = legProgress.currentStep.speedLimitSignStandard |
This adds a new annotation attribute,
segmentMaximumSpeedLimits
which represents the maximum speed limit for a segment./cc @mapbox/navigation-ios @karenzshea