Skip to content
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

optional parameter force_turn_costs #1221

Merged
merged 3 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ RELEASING:
- fix minor spelling errors in Places.md ([#1196](https://github.com/GIScience/openrouteservice/issues/1196))
- address matrix failures for HGV profile ([#1198](https://github.com/GIScience/openrouteservice/issues/1198))

## [6.7.1] - 2022-10-05
### Added
- optional routing profile parameter `force_turn_costs` ([#1220](https://github.com/GIScience/openrouteservice/pull/1220))

## [6.7.0] - 2022-01-04
### Added
- add core matrix algorithm
Expand Down Expand Up @@ -563,7 +567,8 @@ are attached to roads. ([Issue #162](https://github.com/GIScience/openrouteservi
- Fix bug in RPHAST when location lies on a oneway road.
- Consider turn restrictions if optimized=false is passed.

[unreleased]: https://github.com/GIScience/openrouteservice/compare/v6.7.0...HEAD
[unreleased]: https://github.com/GIScience/openrouteservice/compare/v6.7.1...HEAD
[6.7.1]: https://github.com/GIScience/openrouteservice/compare/v6.7.0...v6.7.1
[6.7.0]: https://github.com/GIScience/openrouteservice/compare/v6.6.4...v6.7.0
[6.6.4]: https://github.com/GIScience/openrouteservice/compare/v6.6.3...v6.6.4
[6.6.3]: https://github.com/GIScience/openrouteservice/compare/v6.6.2...v6.6.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public void testSmoothingFactor() {
.then()
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].geometry.coordinates[0].size", is(69))
.body("features[0].geometry.coordinates[0].size()", is(69))
aoles marked this conversation as resolved.
Show resolved Hide resolved
.statusCode(200);

body.put("smoothing", "100");
Expand All @@ -394,7 +394,7 @@ public void testSmoothingFactor() {
.then()
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].geometry.coordinates[0].size", is(94))
.body("features[0].geometry.coordinates[0].size()", is(94))
.statusCode(200);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2718,8 +2718,8 @@ public void testSkipSegments() {
.body("routes[0].containsKey('warnings')", is(true))
.body("routes[0].warnings[0].containsKey('code')", is(true))
.body("routes[0].warnings[0].code", is(3))
.body("routes[0].segments.size", is(4))
.body("routes[0].way_points.size", is(5))
.body("routes[0].segments.size()", is(4))
.body("routes[0].way_points.size()", is(5))
.body("routes[0].bbox[0]", is(0.0f))
.body("routes[0].bbox[1]", is(0.0f))
.statusCode(200);
Expand Down
2 changes: 1 addition & 1 deletion openrouteservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.heigit.ors</groupId>
<artifactId>openrouteservice</artifactId>
<version>6.7.0</version>
<version>6.7.1</version>
<packaging>war</packaging>
<name>openrouteservice</name>
<url>openrouteservice.org</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ public GHResponse computeRoute(double lat0, double lon0, double lat1, double lon
int weightingMethod = searchParams.getWeightingMethod();
RouteSearchContext searchCntx = createSearchContext(searchParams);

int flexibleMode = searchParams.getFlexibleMode() ? KEY_FLEX_PREPROCESSED : KEY_FLEX_STATIC;
int flexibleMode = searchParams.getFlexibleMode() || config.isEnforceTurnCosts() ? KEY_FLEX_PREPROCESSED : KEY_FLEX_STATIC;
boolean optimized = searchParams.getOptimized();

GHRequest req;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class RouteProfileConfiguration {

private int trafficExpirationMin = 15;

private boolean enforceTurnCosts = false;

public RouteProfileConfiguration() {
extStorages = new HashMap<>();
graphBuilders = new HashMap<>();
Expand All @@ -83,6 +85,8 @@ public RouteProfileConfiguration(RouteProfileConfiguration rpc) {

encoderFlagsSize = rpc.encoderFlagsSize;
encoderOptions = rpc.encoderOptions;
enforceTurnCosts = rpc.enforceTurnCosts;

isochronePreparationOpts = rpc.isochronePreparationOpts;
preparationOpts = rpc.preparationOpts;
executionOpts = rpc.executionOpts;
Expand Down Expand Up @@ -403,6 +407,14 @@ public double getMaximumSpeedLowerBound(){
return maximumSpeedLowerBound;
}

public void setEnforceTurnCosts(boolean enforceTurnCosts) {
this.enforceTurnCosts = enforceTurnCosts;
}

public boolean isEnforceTurnCosts() {
return enforceTurnCosts;
}

public void setTrafficExpirationMin(int trafficExpirationMin) {
this.trafficExpirationMin = trafficExpirationMin;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ else if (defaultParams != null) {
case "traffic_expiration_min":
profile.setTrafficExpirationMin(Integer.parseInt(paramItem.getValue().toString()));
break;
case "force_turn_costs":
profile.setEnforceTurnCosts(Boolean.parseBoolean(paramItem.getValue().toString()));
break;
default:
}
}
Expand Down