Port to new string-based BRouter voice hint GeoJSON API #754
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.
This is just a draft to show how little changes a string-based GeoJSON API will actually require. It will make the code more readable an protect against any future changes to voice hint ids / indexing.
(Only the latest commit is relevant, since this is based on #753. I'll rebase this once the other PR got merged. Sadly stacked PRs in GitHub don't really work for external contributors.)
The corresponding change to BRouter is available here, with extensive reasoning in the commit message (probably futile in the end anyway, but at least I tried). I'd recommend to look at the individual commits, most of them are just optional cleanup on top, which became possible by using an
enum
.Of course this is a breaking API change, but compared to the previous sneaky re-indexing (see abrensch/brouter#584) it would be explicit at least.
Another possibility would be to add this as an additional
format=geojsonWithVoiceHints
, which would use strings rather than ids and include voice hints by default:timode=2
affects GeoJSON voice hints. Currently this is a rather crude way of triggering them, see also Always process voice hints for brouter-web? abrensch/brouter#531.turnInstructionMode
where only experts will find it) is only taken after BRouter-Web already requested all data from BRouter. Having to recalculate the whole route (as currently triggered by editing the profile) should be avoided.comment-style
hints would then need to be enabled by default.timode=2
seems to be overridden if anotherturnInstructionMode
is set in the profile (need to check). Not sure yet how to trigger voice hints instead, the earlyreturn
fordetourMap == null
inprocessVoiceHints
might be a hint.Any thoughts appreciated on how to best go forward with it, or whether to just drop the idea entirely.