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 turn lanes support to navigate endpoint #2997
Add turn lanes support to navigate endpoint #2997
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.
I want to add some tests but the problem is the Andorra file used for the navigate endpoint tests doesn't have any turn:lanes I exported to postgres and checked it. same with the latest Andorra file.
InstructionDetails lastDetail = instruction.getInstructionDetails().stream() | ||
.sorted(Comparator.comparingDouble(InstructionDetails::getBeforeTurn)) | ||
.findFirst() | ||
.get(); |
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.
I chose the last lane information because in intersections we can't have more than one lane info. I checked the docs and the mapbox API and it had similar results
for (InstructionDetails details: instructions.get(index + 1).getInstructionDetails()) { | ||
ObjectNode subBannerInstruction = bannerInstructions.addObject(); | ||
subBannerInstruction.put("distanceAlongGeometry", details.getBeforeTurn()); | ||
|
||
ObjectNode subPrimary = subBannerInstruction.putObject("primary"); | ||
putSingleBannerInstruction(instructions.get(index + 1), locale, translationMap, subPrimary); | ||
|
||
ObjectNode sub = subBannerInstruction.putObject("sub"); | ||
sub.put("text", ""); | ||
ArrayNode components = sub.putArray("components"); | ||
for (LaneInfo lane : details.getLanes()) { | ||
ObjectNode component = components.addObject(); | ||
component.put("text", ""); | ||
component.put("type", "lane"); | ||
component.put("active", lane.isValid()); | ||
ArrayNode directions = component.putArray("directions"); | ||
putDirections(instructions.get(index + 1), lane, directions, primary, "active_direction"); |
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.
This requires some explanation, I checked the mapbox navigation API and how it works is:
when there's lane information to show it creates a bannerInstruction with the primary turn only, then it creates a second bannerInstruction with the same primary and a sub that contains the lane information.
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.
Ok, makes sense then. Were you able to test your changes with the mapbox or maplibre SDK?
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 yet, but I'll certainly do. I'll set up the environment and try it out.
Thanks! @boldtrn do you have some time to try it out?
Can you check map-matching/files/leipzig_germany.osm.pbf and the OSM files in core/files/ ? E.g. it seems the file bautzen.osm has turn lane information like for this way it is |
@karussell I added some tests. I chose to create a new test class for the following reasons:
Let me know what you think and if I should change something! |
@@ -85,6 +85,7 @@ Here is an overview: | |||
* thehereward, code cleanups like #620 | |||
* vvikas, ideas for many to many improvements and #616 | |||
* zstadler, multiple fixes and car4wd | |||
* abderrahmane, added turn lane information to navigate endpoint |
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.
minor: as the list has lexicographical order can you move it a bit up :) ?
(btw: will hopefully be able to get some time to test your PR out in the next days)
Here's a simulation that worked well but I still have some doubts that I want to share with you:
|
Nice, thanks a lot! Will merge your PR then!
These are good question! This is indeed a problem I also stumbled over. The problem of announcing them earlier is that we have to ensure that no turn lanes are in-between the current position and next turn lanes as it would be very confusing otherwise. But how can we be 100% sure? Even if there are no turn lanes in-between in the data it might still be that these turn lanes are just missing because they are not mapped. (turn lane data is still very often missing)
Yes, this is a known limitation in certain "tricky" situations. Every improvement is greatly appreciated :) |
Of course I had it locally so this is the request body: { |
Thanks, will investigate. Can you have a look into #2954? Unfortunately the test |
Ok, think I found it... |
Please read our contributing guide and note that also your contribution falls under the Apache License 2.0 as outlined there.
Your first contribution should include a change where you add yourself to the CONTRIBUTORS.md file.