Repository navigation
fix(routing): give Valhalla steps the side traffic keeps to - #1076
Merged
Merged
Conversation
Valhalla names no driving side, so roundabouts with little bend in left-hand traffic were drawn counter-clockwise and a U-turn on one road took the right-hand traffic side. The provider now asks for the countries along the route (admin_crossings) and gives each step the side of the country it starts in, from a list of the 76 countries and territories that drive on the left.
The test set the time slider to 09:00. Run at 09:00, the slider already showed that value, the change event never fired and the test failed.
A stop signal that arrived between the loop starting its 30 s sleep and recording the sleep's pid left the sleep running, and the shutdown handler's wait sat it out. The handler now also stops every remaining background job. The supervisor runtime test timed out on that window in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Valhalla-served routes now know which side traffic keeps to, so roundabouts and U-turns are drawn the right way round in countries that drive on the left.
Valhalla's route response names no driving side, so the app read the circling direction from how the route bends. Where a roundabout bends less than 15° (a mini-roundabout), it fell back to counter-clockwise, which is wrong in the UK, Ireland, Japan, Australia, India and elsewhere. U-turns back along the same road (#1075) took the right-hand side for the same reason. OSRM routes were already right: OSRM reports
driving_sideon every step.Changes in the Valhalla provider:
admin_crossingsoption. Each leg's summary then lists the countries it passes and where it crosses between them.drivingSidefrom the country it starts in. A step that starts at or past the end of the edge crossing a border is in the next country.admin_crossings), the side stays unknown and the app reads it from the route's bend as before.The self-hosted Valhalla (3.9.1, built with
build_admins) supports the option. Data sent is unchanged; the English and German data disclosures now list the countries among the data received.Also fixes a flaky test,
integrations/overlay-sun-time/__tests__/legend.test.tsx, which failed this PR's first CI run. It moved the time slider to 09:00, so run at 09:00 the slider already showed that value and the change event never fired. The test now moves the slider two hours from whatever it shows. With the clock pinned to 09:00, the old version fails and the new one passes.Also fixes a shutdown race in the BRouter supervisor (
services/brouter/scripts/run.sh), which madeservices/brouter/tests/runtime.test.tstime out on a later CI run. The main loop startssleep 30 &and records its pid on the next line. A stop signal between the two left the sleep untracked, and the shutdown handler's finalwaitthen waited up to 30 s for it, after the engine had already stopped. The handler now also stops every remaining background job (jobs -p). In a copy of the script with a 0.2 s pause between the two lines and the signal sent inside it, the old script was still running after 8 s and the new one exits at once. The BRouter tests pass, three runs of the runtime test pass, andshellcheck -xis clean.The rest of the app already reads
drivingSidefrom any engine: the roundabout glyph on the banner, the exit angle on Android Auto, offline sessions, and the raised arrow's U-turn side in #1075.Verification
admin_crossings;pnpm lint,pnpm check:policyandpnpm check-release-information;tscfor the integrations.Release and upgrade impact
Product impact: ordinary
No package release: the only core changes are comments in
packages/core/src/types/routing.tsandpackages/core/src/navigation/roundabout.ts; the extension CLI bundle carries neither.