-
Notifications
You must be signed in to change notification settings - Fork 435
fix: avoid roads reserved to customers #2060
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
base: main
Are you sure you want to change the base?
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.
Pull Request Overview
Adds a weight penalty for roads tagged access=customers
so that routes avoid them by default.
- Defines new customer access factors with bounds checking and integrates them into
LimitedAccessWeighting
. - Applies the
customersPenalty
in the routing weight calculation. - Introduces an API test verifying the distance difference when customer‐reserved roads are penalized and updates the changelog.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
ors-engine/src/main/java/org/heigit/ors/routing/graphhopper/extensions/weighting/LimitedAccessWeighting.java | Added DEFAULT_CUSTOMERS_FACTOR , VEHICLE_CUSTOMERS_FACTOR , bounds, customersPenalty field and logic in constructor/modifyWeight . |
ors-api/src/test/java/org/heigit/ors/apitests/routing/ResultTest.java | Added testCustomersAccess to verify routing behavior when customer‐reserved roads are penalized. |
CHANGELOG.md | Documented the fix for avoiding roads reserved to customers under the “Fixed” section. |
Comments suppressed due to low confidence (1)
ors-engine/src/main/java/org/heigit/ors/routing/graphhopper/extensions/weighting/LimitedAccessWeighting.java:98
- Introduce unit tests for
modifyWeight
covering theRoadAccess.CUSTOMERS
branch to ensurecustomersPenalty
is applied as expected in isolation.
else if (access == RoadAccess.CUSTOMERS)
...ain/java/org/heigit/ors/routing/graphhopper/extensions/weighting/LimitedAccessWeighting.java
Show resolved
Hide resolved
...ain/java/org/heigit/ors/routing/graphhopper/extensions/weighting/LimitedAccessWeighting.java
Outdated
Show resolved
Hide resolved
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.
Just a few minor comments.
.then() | ||
.assertThat() | ||
.body("any { it.key == 'routes' }", is(true)) | ||
.body("routes[0].summary.distance", is(35.6f)) |
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.
floating point values schould be compared with error margin.
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.
Thanks for pointing this out! I've fixed it.
.then() | ||
.assertThat() | ||
.body("any { it.key == 'routes' }", is(true)) | ||
.body("routes[0].summary.distance", is(60.3f)) |
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.
floating point values should be compared with error margin
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.
Thanks for pointing this out! I've fixed it.
...ain/java/org/heigit/ors/routing/graphhopper/extensions/weighting/LimitedAccessWeighting.java
Show resolved
Hide resolved
afa0b7c
to
b3de471
Compare
|
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 #1981.
Information about the changes
access = customers
in order to avoid them during route calculation.Examples and reasons for differences between live ORS routes, and those generated from this pull request
The following examples from the original issue now yield the desired routes.