Conversation
aa8e32f to
2bec148
Compare
|
Hey, thanks a lot for your contribution, and especially thanks for creating tests! I have not looked at the code explicitly, but rather at the When looking at the OSM wiki description for the I would love to see this aligned in the OSM a bit better, rather than complicating the tag parsing of the openrouteservice, but there might be good reason for the openrouteservice to handle this. Could you provide an example on where the current routing fails, i.e. what caused you to add this PR? Last, as a minor nitpick: Best regards :) |
|
Thank you for your comment! For your question about the grade parsing: I did none of the thinking. I executed what @aoles describes in their ticket here: #1774 It looks like the problem for them is that many mistakes could be bundled up and analyzed as a non-existent tag '6', and they provide a count. Regardless, at the moment the lists are handled in such a way that the returned tag can be any number as long as it's the higher number in the list, and that is not, to my understanding, meaningful behavior. I'm very happy to change the logic to whatever your group agrees on! Let me know if there is an agreement :) As for the commit message, no problem! I'll squash all commits into one with the right format once the logic is defined :) Thank you so much for taking the time! |
There was a problem hiding this comment.
Pull request overview
Enhances OSM tracktype parsing in the GraphHopper flag encoder layer (ORS engine) to better handle combined/range-like values (notably --separated lists) and adds unit tests documenting expected parsing behavior.
Changes:
- Extend
getTrackGradeLevelparsing to support;and-separated grade lists via helper parsing methods. - Normalize grades 6–8 to level 6 when encountered (including in lists).
- Add new
VehicleFlagEncoderTestcoverage for null input, list parsing, whitespace handling, and invalid values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| ors-engine/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoder.java | Refactors and expands track grade parsing (supports -, adds helper parsing logic, normalizes 6–8). |
| ors-engine/src/test/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoderTest.java | Introduces tests for getTrackGradeLevel, including list parsing and invalid/edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoder.java
Outdated
Show resolved
Hide resolved
.../java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoderTest.java
Outdated
Show resolved
Hide resolved
.../java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoderTest.java
Outdated
Show resolved
Hide resolved
.../java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoderTest.java
Outdated
Show resolved
Hide resolved
.../java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoderTest.java
Show resolved
Hide resolved
...main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/VehicleFlagEncoder.java
Show resolved
Hide resolved
|
Thanks a lot @hwiks for your contribution and patience! ❤️ We have had a discussion it the team and came up with a somewhat standardised and simplified approach. The general idea is to stick with the values returned by Looking very much forward to reviewing your modified code 🤓 Cheers! |
Parsing of list of grades is now supported. The highest value is returned, with a maximum of five Parsing errors return 0 For values higher than 5, 5 is returned
2bec148 to
e1d7594
Compare
|
Hello! Thank you for the clear added comments: I added the changes and updated the tests, as well as committed in the conventional commit format. Hopefully all is correct, the tests should also clarify how I expect the code to behave in some edge cases, such as: a list of grades where one of them is unparsable should return 0. If you think those edge cases should be handled differently, let me know and I'll update it 👍 |
|



Pull Request Checklist
have been resolved.
[Unreleased] heading.
along with a short description of what it is for, and documented this in the Pull Request (below).
(at least Germany), and the graphs build without problems (i.e. no out-of-memory errors).
importer etc.), I have generated longer distance routes for the affected profiles with different options
(avoid features, max weight etc.) and compared these with the routes of the same parameters and start/end
points generated from the current live ORS.
If there are differences then the reasoning for these MUST be documented in the pull request.
and why the change was needed.
Fixes #1774.
Information about the changes
NOTE: This is my first PR in this project, please review with extra care and especially please double check that my tests make the correct assumptions about desired behavior!!
Examples and reasons for differences between live ORS routes, and those generated from this pull request
Required changes to ors config (if applicable)