-
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)
public static final double DEFAULT_DESTINATION_FACTOR = 1; | ||
public static final double VEHICLE_DESTINATION_FACTOR = 10; | ||
public static final double DEFAULT_PRIVATE_FACTOR = 1.2; | ||
public static final double VEHICLE_PRIVATE_FACTOR = 10; |
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.
Add a Javadoc comment explaining the purpose of DEFAULT_CUSTOMERS_FACTOR
and the corresponding road_access_customers_factor
configuration key to clarify usage.
public static final double VEHICLE_PRIVATE_FACTOR = 10; | |
public static final double VEHICLE_PRIVATE_FACTOR = 10; | |
/** | |
* The default factor applied to roads with "customers" access restrictions. | |
* This factor is used to penalize such roads during route calculation. | |
* It can be overridden by specifying the "road_access_customers_factor" configuration key. | |
*/ |
Copilot uses AI. Check for mistakes.
@@ -52,7 +58,9 @@ public LimitedAccessWeighting(Weighting superWeighting, PMap map) { | |||
destinationPenalty = checkBounds("road_access_destination_factor", map.getDouble("road_access_destination_factor", defaultDestinationFactor), MIN_DESTINATION_FACTOR, MAX_DESTINATION_FACTOR); | |||
double defaultPrivateFactor = encoder.getTransportationMode().isMotorVehicle() ? VEHICLE_PRIVATE_FACTOR : DEFAULT_PRIVATE_FACTOR; | |||
privatePenalty = checkBounds("road_access_private_factor", map.getDouble("road_access_private_factor", defaultPrivateFactor), MIN_PRIVATE_FACTOR, MAX_PRIVATE_FACTOR); | |||
roadAccessEnc = destinationPenalty > 1 || privatePenalty > 1 ? encoder.getEnumEncodedValue(RoadAccess.KEY, RoadAccess.class) : null; | |||
double defaultCustomersFactor = encoder.getTransportationMode().isMotorVehicle() ? VEHICLE_CUSTOMERS_FACTOR : DEFAULT_CUSTOMERS_FACTOR; | |||
customersPenalty = checkBounds("road_access_customers_factor", map.getDouble("road_access_customers_factor", defaultCustomersFactor), MIN_CUSTOMERS_FACTOR, MAX_CUSTOMERS_FACTOR); |
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.
Update the external configuration documentation (ors-config.json
docs) to mention the new road_access_customers_factor
parameter, its default, and valid bounds.
Copilot uses AI. Check for mistakes.
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.