diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bef377439..48201471c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) - Improve recommended weighting for cycling and walking profiles ([#665](https://github.com/GIScience/openrouteservice/issues/665)) - Restructure AdditionWeighting ### Deprecated +- Use recommended weighting instead of fastest ([#763](https://github.com/GIScience/openrouteservice/issues/763)) ## [6.1.1] - 2020-06-02 ### Added diff --git a/openrouteservice-api-tests/conf/app.config.test b/openrouteservice-api-tests/conf/app.config.test index 379db8c22e..5291204f8f 100644 --- a/openrouteservice-api-tests/conf/app.config.test +++ b/openrouteservice-api-tests/conf/app.config.test @@ -68,7 +68,7 @@ { enabled: true, threads: 1, - weightings: "fastest,shortest", + weightings: "recommended,shortest", landmarks: 16 } } @@ -176,20 +176,20 @@ { enabled: true, threads: 1, - weightings: "fastest" + weightings: "recommended" }, lm: { enabled: true, threads: 1, - weightings: "fastest", + weightings: "recommended", landmarks: 16 }, core: { enabled: true, threads: 1, - weightings: "fastest,shortest", + weightings: "recommended,shortest", landmarks: 32 } } @@ -244,7 +244,7 @@ { enabled: true, threads: 1, - weightings: "fastest,shortest", + weightings: "recommended,shortest", landmarks: 32 } } diff --git a/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ParamsTest.java b/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ParamsTest.java index ee377f736b..fa363da813 100644 --- a/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ParamsTest.java +++ b/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ParamsTest.java @@ -31,7 +31,7 @@ public ParamsTest() { addParameter("coordinatesLong", "8.678613,49.411721|4.78906,53.071752"); addParameter("coordinatesShortThree", "8.678613,49.411721|8.687782,49.424597|8.691087,49.425009"); addParameter("extra_info", "surface|suitability|steepness"); - addParameter("preference", "fastest"); + addParameter("preference", "recommended"); addParameter("profile", "cycling-regular"); addParameter("carProfile", "driving-car"); } @@ -656,9 +656,9 @@ public void expectRadiusesFormatError() { public void expectNoNearestEdge() { given() .param("coordinates", "8.689585,49.399733|8.686495,49.40349") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("geometry", "true") - .param("profile", "cycling-regular") + .param("profile", getParameter("profile")) .param("radiuses", "5|150") .when() .get(getEndPointName()) diff --git a/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ResultTest.java b/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ResultTest.java index 01f5855bbe..067ecc12a7 100644 --- a/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ResultTest.java +++ b/openrouteservice-api-tests/src/test/java/org/heigit/ors/services/routing/ResultTest.java @@ -50,7 +50,7 @@ public ResultTest() { addParameter("coordinatesShort", "8.678613,49.411721|8.687782,49.424597"); addParameter("coordinatesLong", "8.678613,49.411721|8.714733,49.393267|8.687782,49.424597"); addParameter("extra_info", "surface|suitability|steepness"); - addParameter("preference", "fastest"); + addParameter("preference", "recommended"); addParameter("bikeProfile", "cycling-regular"); addParameter("carProfile", "driving-car"); @@ -617,10 +617,10 @@ public void testSummary() { .body("any { it.key == 'routes' }", is(true)) .body("routes[0].containsKey('segments')", is(true)) .body("routes[0].segments.size()", is(2)) - .body("routes[0].summary.distance", is(11137.6f)) - .body("routes[0].summary.duration", is(2522.6f)) - .body("routes[0].summary.ascent", is(342.2f)) - .body("routes[0].summary.descent", is(338.8f)) + .body("routes[0].summary.distance", is(13079)) + .body("routes[0].summary.duration", is(2737)) + .body("routes[0].summary.ascent", is(351)) + .body("routes[0].summary.descent", is(347.6f)) .statusCode(200); } @@ -639,10 +639,10 @@ public void testSegmentDistances() { .body("any { it.key == 'routes' }", is(true)) .body("routes[0].containsKey('segments')", is(true)) .body("routes[0].segments.size()", is(2)) - .body("routes[0].segments[0].distance", is(5544.1f)) - .body("routes[0].segments[0].duration", is(1260.6f)) - .body("routes[0].segments[1].distance", is(5593.5f)) - .body("routes[0].segments[1].duration", is(1262)) + .body("routes[0].segments[0].distance", is(6696.6f)) + .body("routes[0].segments[0].duration", is(1398.4f)) + .body("routes[0].segments[1].distance", is(6382.4f)) + .body("routes[0].segments[1].duration", is(1338.6f)) .statusCode(200); } @@ -663,7 +663,7 @@ public void testEncodedPolyline() { .body("any { it.key == 'routes' }", is(true)) .body( "routes[0].geometry", - is("gvqlHk`~s@cwUB?tC?Cp@NAdIAE`EQaCi@WiCaDcAuG?C]g@MaBVM_C`HCInAKcA~CAIjA?GhAGqAzDEsAh@Eu@a@CcA{@GqAuCAQeAC_A_DAOoAEcAaCEgAsB@Wu@E?q@KB]AYIEo@?AOBcAyGbBIiADIaA?EmBq@CyA]AaAHAa@HAgAeARCHHAHCqBp@BIHAy@VAURJQX@M\\?E\\?]\\Cm@\\ATR@RH?JFAd@d@K?`AAw@HDA?~HsArCF?VF@XF@XB@VBDVBBRFRz@HVz@FJv@LZv@JTr@BBt@D@p@B@p@RAl@HCl@RGl@PIcAvAu@{IPGeA~@e@uHVMkCFCkCJCkCRCkCZFkCNFkCDFkC\\ZiDBBiDJDiDPD{@JB{@J?{@R?{@PA{@b@CwBAKq@AQ{@?Gq@AMq@AGq@Gm@q@WwC{EGg@S?MSJES~CcAg@|@[z@HARFAR?CRIaCrD?Mz@Ce@x@NMv@RCj@HAf@l@e@jANK`@tBwAkQFIiDBAsD??}DZjBkL@?q@@Ai@?{@_ID]gEF[gEBUiDJqAsMD@aF@LcEBx@cBPy@qEBIkCBEqDJSiO@KoPQkAmVEMkHGEyEW?mCAEkCn@e@uONEkM\\CeKXHeKJFeKDBkMRXwLn@hBuf@Xd@qMPLkMv@L}g@NB}I?G}I@OkOBIwLMU{EQk@{EC[{E@qA}QQo@gYIm@cLAQcLDiA}ZEaAsNIe@oIU]}PKKuMMOuMk@i@gTcAYuR?MqEGA{CEAcBECcBCEcBOUjCQk@ReA_IpW[eA{@M]]HF]V`@]N`@]Ph@mG\\jBeIRz@YRl@qIH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@f@q@y@X{@eBt@XYJ?E@?_@LSmA`@Bc@NR{C`Av@_DfAf@uAf@{BMHYKJWG@WGCUINSCGSI?SKBQ")) .statusCode(200); } @@ -681,7 +681,7 @@ public void testWaypoints() { .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].way_points", hasItems(0, 271, 509)) + .body("routes[0].way_points", hasItems(0, 332, 624)) .statusCode(200); } @@ -698,7 +698,7 @@ public void testBbox() { .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].bbox", hasItems(8.678615f, 49.393272f, 8.714833f, 49.424603f)) + .body("routes[0].bbox", hasItems(8.678615f, 49.388405f, 8.719662f, 49.424603f)) .statusCode(200); } @@ -716,7 +716,7 @@ public void testManeuver() { .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].bbox", hasItems(8.678615f, 49.393272f, 8.714833f, 49.424603f)) + .body("routes[0].bbox", hasItems(8.678615f, 49.388405f, 8.719662f, 49.424603f)) .body("routes[0].segments[0].steps[0].maneuver.bearing_before", is(0)) //.body("routes[0].segments[0].steps[0].maneuver.bearing_after", is(260)) .body("routes[0].segments[0].steps[0].maneuver.bearing_after", is(175)) @@ -767,10 +767,10 @@ public void testExtrasDetails() { .assertThat() .body("any { it.key == 'routes' }", is(true)) .body("routes[0].containsKey('extras')", is(true)) - .body("routes[0].extras.surface.values.size()", is(44)) - .body("routes[0].extras.surface.values[26][1]", is(281)) - .body("routes[0].extras.suitability.values[29][0]", is(429)) - .body("routes[0].extras.steepness.values[11][1]", is(265)) + .body("routes[0].extras.surface.values.size()", is(28)) + .body("routes[0].extras.surface.values[18][1]", is(342)) + .body("routes[0].extras.suitability.values[18][0]", is(521)) + .body("routes[0].extras.steepness.values[10][1]", is(326)) .statusCode(200); @@ -799,7 +799,7 @@ public void testTrailDifficultyExtraDetails() { Response response = given() .param("coordinates", "8.763442,49.388882|8.762927,49.397541") .param("instructions", "true") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("profile", "cycling-regular") .param("extra_info", "suitability|traildifficulty") .when().log().ifValidationFails() @@ -824,7 +824,7 @@ public void testTrailDifficultyExtraDetails() { response = given() .param("coordinates", "8.724174,49.390223|8.716536,49.399622") .param("instructions", "true") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("profile", "foot-hiking") .param("extra_info", "traildifficulty") .when().log().ifValidationFails() @@ -856,7 +856,7 @@ public void testTollwaysExtraDetails() { Response response = given() .param("coordinates", "8.676281,49.414715|8.6483,49.413291") .param("instructions", "true") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("profile", "driving-car") .param("extra_info", "suitability|tollways") .when().log().ifValidationFails() @@ -877,7 +877,7 @@ public void testTollwaysExtraDetails() { response = given() .param("coordinates", "8.676281,49.414715|8.6483,49.413291") .param("instructions", "true") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("profile", "driving-hgv") .param("extra_info", "suitability|tollways") .when().log().ifValidationFails() @@ -904,7 +904,7 @@ public void testTollwaysExtraDetails() { response = given() .param("coordinates", "8.676281,49.414715|8.6483,49.413291") .param("instructions", "true") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("profile", "driving-hgv") .param("continue_straight", "false") .param("options", "{\"profile_params\":{\"width\":\"2\",\"height\":\"2\",\"weight\":\"14\"},\"vehicle_type\":\"hgv\"}") @@ -953,7 +953,7 @@ public void testOptimizedAndTurnRestrictions() { public void testNoBearings() { given() .param("coordinates", "8.688694,49.399374|8.686495,49.40349") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("geometry", "true") .param("profile", "cycling-regular") .when().log().ifValidationFails() @@ -970,7 +970,7 @@ public void testNoBearings() { public void testBearingsForStartAndEndPoints() { given() .param("coordinates", "8.688694,49.399374|8.686495,49.40349") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("geometry", "true") .param("profile", "cycling-road") .param("bearings", "25,30|90,20") @@ -987,7 +987,7 @@ public void testBearingsForStartAndEndPoints() { public void testBearingsExceptLastPoint() { given() .param("coordinates", "8.688694,49.399374|8.686495,49.40349") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("geometry", "true") .param("profile", "cycling-road") .param("bearings", "25,30") @@ -1004,7 +1004,7 @@ public void testBearingsExceptLastPoint() { public void testBearingsSkipwaypoint() { given() .param("coordinates", "8.688694,49.399374|8.686495,49.40349") - .param("preference", "fastest") + .param("preference", getParameter("preference")) .param("geometry", "true") .param("profile", "cycling-regular") .param("bearings", "|90,20") @@ -1032,10 +1032,8 @@ public void testSteps() { .body("any { it.key == 'routes' }", is(true)) .body("routes[0].segments[0].containsKey('steps')", is(true)) .body("routes[0].segments[1].containsKey('steps')", is(true)) - //.body("routes[0].segments[0].steps.size()", is(55)) - .body("routes[0].segments[0].steps.size()", is(39)) - //.body("routes[0].segments[1].steps.size()", is(28)) - .body("routes[0].segments[1].steps.size()", is(25)) + .body("routes[0].segments[0].steps.size()", is(34)) + .body("routes[0].segments[1].steps.size()", is(17)) .statusCode(200); } @@ -1054,8 +1052,8 @@ public void testStepsDetails() { .body("any { it.key == 'routes' }", is(true)) .body("routes[0].segments[0].containsKey('steps')", is(true)) .body("routes[0].segments[1].containsKey('steps')", is(true)) - .body("routes[0].segments[0].steps.size()", is(39)) - .body("routes[0].segments[1].steps.size()", is(25)) + .body("routes[0].segments[0].steps.size()", is(34)) + .body("routes[0].segments[1].steps.size()", is(17)) .body("routes[0].segments[0].steps[3].distance", is(337.3f)) .body("routes[0].segments[0].steps[3].duration", is(67.5f)) .body("routes[0].segments[0].steps[3].type", is(0)) diff --git a/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ParamsTest.java b/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ParamsTest.java index 595ff46942..d8632added 100644 --- a/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ParamsTest.java +++ b/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ParamsTest.java @@ -103,7 +103,7 @@ public ParamsTest() { extraInfo.put("steepness"); addParameter("extra_info", extraInfo); - addParameter("preference", "fastest"); + addParameter("preference", "recommended"); addParameter("profile", "cycling-regular"); addParameter("carProfile", "driving-car"); addParameter("footProfile", "foot-walking"); @@ -946,7 +946,7 @@ public void expectNoNearestEdge() { coordinates.put(coord2); body.put("coordinates", coordinates); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); JSONArray radii = new JSONArray(); radii.put(50); @@ -958,7 +958,7 @@ public void expectNoNearestEdge() { given() .header("Accept", "application/json") .header("Content-Type", "application/json") - .pathParam("profile", "cycling-regular") + .pathParam("profile", getParameter("profile")) .body(body.toString()) .when() .post(getEndPointPath()+"/{profile}/json") @@ -1734,7 +1734,7 @@ public void testMaximumSpeedLowerBound() { given() .header("Accept", "application/json") .header("Content-Type", "application/json") - .pathParam("profile", "driving-car") + .pathParam("profile", getParameter("carProfile")) .body(body.toString()) .when() .post(getEndPointPath() + "/{profile}") @@ -1756,7 +1756,7 @@ public void testMaximumSpeedUnsupportedProfile() { given() .header("Accept", "application/json") .header("Content-Type", "application/json") - .pathParam("profile", "cycling-regular") + .pathParam("profile", getParameter("profile")) .body(body.toString()) .when() .post(getEndPointPath() + "/{profile}") diff --git a/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ResultTest.java b/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ResultTest.java index 623fac7912..df6cf54042 100644 --- a/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ResultTest.java +++ b/openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ResultTest.java @@ -97,7 +97,7 @@ public ResultTest() { extraInfo.put("countryinfo"); addParameter("extra_info", extraInfo); - addParameter("preference", "fastest"); + addParameter("preference", "recommended"); addParameter("bikeProfile", "cycling-regular"); addParameter("carProfile", "driving-car"); addParameter("footProfile", "foot-walking"); @@ -760,10 +760,10 @@ public void testSummary() { .body("any { it.key == 'routes' }", is(true)) .body("routes[0].containsKey('segments')", is(true)) .body("routes[0].segments.size()", is(2)) - .body("routes[0].summary.distance", is(11137.6f)) - .body("routes[0].summary.duration", is(2522.6f)) - .body("routes[0].summary.ascent", is(342.2f)) - .body("routes[0].summary.descent", is(338.8f)) + .body("routes[0].summary.distance", is(13079.0f)) + .body("routes[0].summary.duration", is(2737.0f)) + .body("routes[0].summary.ascent", is(351.0f)) + .body("routes[0].summary.descent", is(347.6f)) .statusCode(200); } @@ -788,10 +788,10 @@ public void testSegmentDistances() { .body("routes[0].containsKey('segments')", is(true)) .body("routes[0].segments.size()", is(2)) - .body("routes[0].segments[0].distance", is(5544.1f)) - .body("routes[0].segments[0].duration", is(1260.6f)) - .body("routes[0].segments[1].distance", is(5593.5f)) - .body("routes[0].segments[1].duration", is(1262f)) + .body("routes[0].segments[0].distance", is(6696.6f)) + .body("routes[0].segments[0].duration", is(1398.4f)) + .body("routes[0].segments[1].distance", is(6382.4f)) + .body("routes[0].segments[1].duration", is(1338.6f)) .statusCode(200); } @@ -815,7 +815,7 @@ public void testEncodedPolyline() { .body("any { it.key == 'routes' }", is(true)) .body( "routes[0].geometry", - is("gvqlHk`~s@cwUB?tC?Cp@NAdIAE`EQaCi@WiCaDcAuG?C]g@MaBVM_C`HCInAKcA~CAIjA?GhAGqAzDEsAh@Eu@a@CcA{@GqAuCAQeAC_A_DAOoAEcAaCEgAsB@Wu@E?q@KB]AYIEo@?AOBcAyGbBIiADIaA?EmBq@CyA]AaAHAa@HAgAeARCHHAHCqBp@BIHAy@VAURJQX@M\\?E\\?]\\Cm@\\ATR@RH?JFAd@d@K?`AAw@HDA?~HsArCF?VF@XF@XB@VBDVBBRFRz@HVz@FJv@LZv@JTr@BBt@D@p@B@p@RAl@HCl@RGl@PIcAvAu@{IPGeA~@e@uHVMkCFCkCJCkCRCkCZFkCNFkCDFkC\\ZiDBBiDJDiDPD{@JB{@J?{@R?{@PA{@b@CwBAKq@AQ{@?Gq@AMq@AGq@Gm@q@WwC{EGg@S?MSJES~CcAg@|@[z@HARFAR?C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@?n@I@`@I?HIiBHEB|CfA@tApB@x@nA@Lf@BXf@HbBvBP|BnCHv@fA@H^Fn@ZFn@B@J??B?D^?Fv@??F?FbA]?BS@RS?RSBnAQ@ZG?^I?RM@f@SBrASBb@HDtB{@F~BeA?V]BV]KDg@{C~@iBoHhBxm@K?`BSCxAGBnAO@hAUJdACB`AEBz@oIxAsHE@gAk@HsCG?gA[BaAU@_AG^{@CBw@qADiFqAFkEK?i@I@e@gA?mC{@ByAO?][@]o@Bg@iCHMO@HC?Hk@@Xm@Hd@ODR]VRgAlAnD_AfAfEURp@EDp@C?p@Q?p@OBRE@RqBn@xCA@RSHHOJ]ELg@CDg@gAb@_Dq@\\wBmAt@{@y@f@q@y@X{@eBt@XYJ?E@?_@LSmA`@Bc@NR{C`Av@_DfAf@uAf@{BMHYKJWG@WGCUINSCGSI?SKBQ")) .statusCode(200); } @@ -837,7 +837,7 @@ public void testWaypoints() { .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].way_points", hasItems(0, 271, 509)) + .body("routes[0].way_points", hasItems(0, 332, 624)) .statusCode(200); } @@ -859,7 +859,7 @@ public void testBbox() { .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].bbox", hasItems(8.678615f, 49.393272f, 107.83f, 8.714833f, 49.424603f, 404.73f)) + .body("routes[0].bbox", hasItems(8.678615f, 49.388405f, 107.83f, 8.719662f, 49.424603f, 404.73f)) .statusCode(200); } @@ -882,16 +882,12 @@ public void testManeuver() { .then().log().ifValidationFails() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].bbox", hasItems(8.678615f, 49.393272f, 107.83f, 8.714833f, 49.424603f, 404.73f)) + .body("routes[0].bbox", hasItems(8.678615f, 49.388405f, 107.83f, 8.719662f, 49.424603f, 404.73f)) .body("routes[0].segments[0].steps[0].maneuver.bearing_before", is(0)) - //.body("routes[0].segments[0].steps[0].maneuver.bearing_after", is(260)) .body("routes[0].segments[0].steps[0].maneuver.bearing_after", is(175)) .body("routes[0].segments[0].steps[0].maneuver.containsKey('location')", is(true)) - //.body("routes[0].segments[0].steps[1].maneuver.bearing_before", is(298)) .body("routes[0].segments[0].steps[1].maneuver.bearing_before", is(175)) - //.body("routes[0].segments[0].steps[1].maneuver.bearing_after", is(4)) .body("routes[0].segments[0].steps[1].maneuver.bearing_after", is(80)) - //.body("routes[0].segments[0].steps[1].maneuver.location", hasItems(8.673925f, 49.411283f)) .body("routes[0].segments[0].steps[1].maneuver.location", hasItems(8.678618f, 49.411697f)) .statusCode(200); } @@ -942,10 +938,10 @@ public void testExtrasDetails() { .assertThat() .body("any { it.key == 'routes' }", is(true)) .body("routes[0].containsKey('extras')", is(true)) - .body("routes[0].extras.surface.values.size()", is(44)) - .body("routes[0].extras.surface.values[26][1]", is(281)) - .body("routes[0].extras.suitability.values[29][0]", is(429)) - .body("routes[0].extras.steepness.values[11][1]", is(265)) + .body("routes[0].extras.surface.values.size()", is(28)) + .body("routes[0].extras.surface.values[18][1]", is(342)) + .body("routes[0].extras.suitability.values[18][0]", is(521)) + .body("routes[0].extras.steepness.values[10][1]", is(326)) .statusCode(200); checkExtraConsistency(response); @@ -976,14 +972,14 @@ public void testExtrasConsistency() { public void testTrailDifficultyExtraDetails() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.763442,49.388882|8.762927,49.397541")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("instructions", true); body.put("extra_info", constructExtras("suitability|traildifficulty")); Response response = given() .header("Accept", "application/json") .header("Content-Type", "application/json") - .pathParam("profile", "cycling-regular") + .pathParam("profile", getParameter("bikeProfile")) .body(body.toString()) .when() .post(getEndPointPath() + "/{profile}"); @@ -997,7 +993,6 @@ public void testTrailDifficultyExtraDetails() { .body("routes[0].extras.traildifficulty.values[0][1]", is(2)) .body("routes[0].extras.traildifficulty.values[0][2]", is(2)) .body("routes[0].extras.traildifficulty.values[1][0]", is(2)) - //.body("routes[0].extras.traildifficulty.values[1][1]", is(20)) .body("routes[0].extras.traildifficulty.values[1][1]", is(6)) .body("routes[0].extras.traildifficulty.values[1][2]", is(1)) .statusCode(200); @@ -1006,7 +1001,7 @@ public void testTrailDifficultyExtraDetails() { body = new JSONObject(); body.put("coordinates", constructCoords("8.724174,49.390223|8.716536,49.399622")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("instructions", true); body.put("extra_info", constructExtras("traildifficulty")); @@ -1041,7 +1036,7 @@ public void testTrailDifficultyExtraDetails() { public void testTollwaysExtraDetails() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.676281,49.414715|8.6483,49.413291")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("instructions", true); body.put("extra_info", constructExtras("suitability|tollways")); @@ -1232,6 +1227,8 @@ public void testMaximumSpeed() { //Test profile-specific maximum speed lower bound body.put("maximum_speed", 75); + body.put("optimized", false); //FIXME: remove once turn restrictions are supported by CALT + given() .header("Accept", "application/json") .header("Content-Type", "application/json") @@ -1242,7 +1239,7 @@ public void testMaximumSpeed() { .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].summary.duration", is(1986.6f)) + .body("routes[0].summary.duration", is(2148.5f)) .statusCode(200); } @@ -1250,20 +1247,19 @@ public void testMaximumSpeed() { public void testNoBearings() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.688694,49.399374|8.686495,49.40349")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("geometry", true); given() .header("Accept", "application/json") .header("Content-Type", "application/json") - .pathParam("profile", "cycling-regular") + .pathParam("profile", getParameter("bikeProfile")) .body(body.toString()) .when() .post(getEndPointPath() + "/{profile}") .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - //.body("routes[0].summary.distance", is(620.1f)) .body("routes[0].summary.distance", is(617.1f)) .statusCode(200); } @@ -1272,7 +1268,7 @@ public void testNoBearings() { public void testBearingsForStartAndEndPoints() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.688694,49.399374|8.686495,49.40349")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("geometry", true); body.put("bearings", constructBearings("25,30|90,20")); @@ -1294,7 +1290,7 @@ public void testBearingsForStartAndEndPoints() { public void testBearingsExceptLastPoint() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.688694,49.399374|8.686495,49.40349")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("geometry", true); body.put("bearings", constructBearings("25,30")); @@ -1316,21 +1312,20 @@ public void testBearingsExceptLastPoint() { public void testBearingsSkipwaypoint() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.688694,49.399374|8.686495,49.40349")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("geometry", true); body.put("bearings", constructBearings("|90,20")); given() .header("Accept", "application/json") .header("Content-Type", "application/json") - .pathParam("profile", "cycling-regular") + .pathParam("profile", getParameter("bikeProfile")) .body(body.toString()) .when() .post(getEndPointPath() + "/{profile}") .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - //.body("routes[0].summary.distance", is(714.7f)) .body("routes[0].summary.distance", is(751.5f)) .statusCode(200); } @@ -1354,10 +1349,8 @@ public void testSteps() { .body("any { it.key == 'routes' }", is(true)) .body("routes[0].segments[0].containsKey('steps')", is(true)) .body("routes[0].segments[1].containsKey('steps')", is(true)) - //.body("routes[0].segments[0].steps.size()", is(55)) - .body("routes[0].segments[0].steps.size()", is(39)) - //.body("routes[0].segments[1].steps.size()", is(28)) - .body("routes[0].segments[1].steps.size()", is(25)) + .body("routes[0].segments[0].steps.size()", is(34)) + .body("routes[0].segments[1].steps.size()", is(17)) .statusCode(200); } @@ -1380,8 +1373,8 @@ public void testStepsDetails() { .body("any { it.key == 'routes' }", is(true)) .body("routes[0].segments[0].containsKey('steps')", is(true)) .body("routes[0].segments[1].containsKey('steps')", is(true)) - .body("routes[0].segments[0].steps.size()", is(39)) - .body("routes[0].segments[1].steps.size()", is(25)) + .body("routes[0].segments[0].steps.size()", is(34)) + .body("routes[0].segments[1].steps.size()", is(17)) .body("routes[0].segments[0].steps[3].distance", is(337.3f)) .body("routes[0].segments[0].steps[3].duration", is(67.5f)) .body("routes[0].segments[0].steps[3].type", is(0)) @@ -2554,7 +2547,7 @@ public void testPreferQuiet() { public void testRouteMergeIndexing() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.676131,49.418149|8.676142,49.417555|8.680733,49.417248")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); // ensure indexing of merged routes waypoints dont get messed up given() @@ -2584,7 +2577,7 @@ public void testRouteMergeIndexing() { public void testRouteMergeInstructionsWithoutGeometry() { JSONObject body = new JSONObject(); body.put("coordinates", constructCoords("8.676131,49.418149|8.676142,49.417555|8.680733,49.417248")); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); body.put("geometry", "false"); // ensure indexing of merged routes waypoints dont get messed up @@ -2791,7 +2784,7 @@ public void testAlternativeRoutes() { coordinates.put(coord2); body.put("coordinates", coordinates); - body.put("preference", "fastest"); + body.put("preference", getParameter("preference")); JSONObject ar = new JSONObject(); ar.put("target_count", "2"); ar.put("share_factor", "0.5"); @@ -3007,7 +3000,7 @@ public void expectNoInterpolationOfBridgesAndTunnels() { @Test public void expectElevationSmoothing() { JSONObject body = new JSONObject(); - body.put("coordinates", getParameter("coordinatesWalking")); + body.put("coordinates", getParameter("coordinatesShort")); body.put("preference", getParameter("preference")); body.put("elevation", true); @@ -3021,25 +3014,11 @@ public void expectElevationSmoothing() { .then() .assertThat() .body("any { it.key == 'routes' }", is(true)) - .body("routes[0].summary.distance", is(2092.0f)) - .body("routes[0].summary.ascent", is(16.8f)) - .body("routes[0].summary.descent", is(13.8f)) + .body("routes[0].summary.distance", is(2002.4f)) + .body("routes[0].summary.ascent", is(7.5f)) + .body("routes[0].summary.descent", is(6.2f)) .statusCode(200); } - - private JSONArray constructCoords(String coordString) { - JSONArray coordinates = new JSONArray(); - String[] coordPairs = coordString.split("\\|"); - for (String pair : coordPairs) { - JSONArray coord = new JSONArray(); - String[] pairCoords = pair.split(","); - coord.put(Double.parseDouble(pairCoords[0])); - coord.put(Double.parseDouble(pairCoords[1])); - coordinates.put(coord); - } - - return coordinates; - } private JSONArray constructBearings(String coordString) { JSONArray coordinates = new JSONArray(); @@ -3057,7 +3036,6 @@ private JSONArray constructBearings(String coordString) { return coordinates; } - private JSONArray constructExtras(String extrasString) { return constructFromPipedList(extrasString); } diff --git a/openrouteservice/src/main/java/org/heigit/ors/api/requests/routing/RouteRequest.java b/openrouteservice/src/main/java/org/heigit/ors/api/requests/routing/RouteRequest.java index 10a2cb36df..dbbf5885a8 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/api/requests/routing/RouteRequest.java +++ b/openrouteservice/src/main/java/org/heigit/ors/api/requests/routing/RouteRequest.java @@ -77,8 +77,8 @@ public class RouteRequest { private APIEnums.Profile profile; @ApiModelProperty(name = PARAM_PREFERENCE, - value = "Specifies the route preference. CUSTOM_KEYS:{'apiDefault':'fastest'}", - example = "fastest") + value = "Specifies the route preference. CUSTOM_KEYS:{'apiDefault':'recommended'}", + example = "recommended") @JsonProperty(value = PARAM_PREFERENCE) private APIEnums.RoutePreference routePreference; @JsonIgnore diff --git a/openrouteservice/src/main/java/org/heigit/ors/matrix/MatrixRequest.java b/openrouteservice/src/main/java/org/heigit/ors/matrix/MatrixRequest.java index 65a600ce0a..9bf3a73a88 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/matrix/MatrixRequest.java +++ b/openrouteservice/src/main/java/org/heigit/ors/matrix/MatrixRequest.java @@ -15,6 +15,7 @@ import com.vividsolutions.jts.geom.Coordinate; import org.heigit.ors.common.DistanceUnit; +import org.heigit.ors.routing.WeightingMethod; import org.heigit.ors.services.ServiceRequest; public class MatrixRequest extends ServiceRequest { @@ -22,7 +23,7 @@ public class MatrixRequest extends ServiceRequest { private Coordinate[] sources; private Coordinate[] destinations; private int metrics = MatrixMetricsType.DURATION; - private String weightingMethod; + private int weightingMethod; private DistanceUnit units = DistanceUnit.METERS; private boolean resolveLocations = false; private boolean flexibleMode = false; @@ -87,12 +88,12 @@ public int getTotalNumberOfLocations() return destinations.length * sources.length; } - public String getWeightingMethod() { + public int getWeightingMethod() { return weightingMethod; } - public void setWeightingMethod(String weighting) { - weightingMethod = weighting; + public void setWeightingMethod(int weightingMethod) { + this.weightingMethod = weightingMethod; } public boolean getFlexibleMode() { diff --git a/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java b/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java index ee2f381081..f13822c667 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java +++ b/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java @@ -85,6 +85,7 @@ public class RoutingProfile { private static final String VAL_FASTEST = "fastest"; private static final String VAL_RECOMMENDED = "recommended"; private static final String VAL_RECOMMENDED_PREF = "recommended_pref"; + private static final String KEY_WEIGHTING = "weighting"; private static final String KEY_WEIGHTING_METHOD = "weighting_method"; private static final String KEY_CH_DISABLE = "ch.disable"; private static final String KEY_LM_DISABLE = "lm.disable"; @@ -598,12 +599,13 @@ public MatrixResult computeMatrix(MatrixRequest req) throws Exception { throw new Exception("Unable to create an algorithm to for computing distance/duration matrix."); try { - String weightingStr = Helper.isEmpty(req.getWeightingMethod()) ? VAL_FASTEST : req.getWeightingMethod(); + HintsMap hintsMap = new HintsMap(); + int weightingMethod = req.getWeightingMethod() == WeightingMethod.UNKNOWN ? WeightingMethod.RECOMMENDED : req.getWeightingMethod(); + setWeighting(hintsMap, weightingMethod, req.getProfileType()); Graph graph = null; - if (!req.getFlexibleMode() && gh.getCHFactoryDecorator().isEnabled() && gh.getCHFactoryDecorator().getCHProfileStrings().contains(weightingStr)) { - HintsMap map = new HintsMap(weightingStr); - map.setVehicle(encoderName); - graph = gh.getGraphHopperStorage().getCHGraph(((PrepareContractionHierarchies) gh.getAlgorithmFactory(map)).getCHProfile()); + if (!req.getFlexibleMode() && gh.getCHFactoryDecorator().isEnabled() && gh.getCHFactoryDecorator().getCHProfileStrings().contains(hintsMap.getWeighting())) { + hintsMap.setVehicle(encoderName); + graph = gh.getGraphHopperStorage().getCHGraph(((PrepareContractionHierarchies) gh.getAlgorithmFactory(hintsMap)).getCHProfile()); } else graph = gh.getGraphHopperStorage().getBaseGraph(); @@ -611,8 +613,6 @@ public MatrixResult computeMatrix(MatrixRequest req) throws Exception { MatrixSearchContextBuilder builder = new MatrixSearchContextBuilder(gh.getLocationIndex(), DefaultEdgeFilter.allEdges(flagEncoder), req.getResolveLocations()); MatrixSearchContext mtxSearchCntx = builder.create(graph, req.getSources(), req.getDestinations(), MatrixServiceSettings.getMaximumSearchRadius()); - HintsMap hintsMap = new HintsMap(); - hintsMap.setWeighting(weightingStr); Weighting weighting = new ORSWeightingFactory().createWeighting(hintsMap, flagEncoder, gh.getGraphHopperStorage()); alg.init(req, gh, mtxSearchCntx.getGraph(), flagEncoder, weighting); @@ -788,7 +788,7 @@ public GHResponse computeRoundTripRoute(double lat0, double lon0, WayPointBearin req.getHints().merge(props); if (supportWeightingMethod(profileType)) - setWeighting(req, weightingMethod, profileType, searchParams.getVehicleType()); + setWeighting(req.getHints(), weightingMethod, profileType); else throw new IllegalArgumentException("Unsupported weighting " + weightingMethod + " for profile + " + profileType); @@ -856,7 +856,7 @@ else if (bearings[1] == null) req.getHints().merge(props); if (supportWeightingMethod(profileType)) { - setWeighting(req, weightingMethod, profileType, searchParams.getVehicleType()); + setWeighting(req.getHints(), weightingMethod, profileType); flexibleMode = getFlexibilityMode(flexibleMode, searchParams, profileType); } else @@ -947,37 +947,37 @@ private int getFlexibilityMode(int flexibleMode, RouteSearchParameters searchPar * Set the weighting for the request based on input weighting. * Also set the weighting_method. * - * @param req Request to be modified + * @param map Hints map for setting up the request * @param requestWeighting Originally requested weighting * @param profileType Necessary for HGV - * @param vehicleType Necessary for HGV * @return Weighting as int */ - private void setWeighting(GHRequest req, int requestWeighting, int profileType, int vehicleType){ + private void setWeighting(HintsMap map, int requestWeighting, int profileType){ //Defaults - String weighting = VAL_FASTEST; - String weightingMethod = VAL_FASTEST; - - if(requestWeighting == WeightingMethod.FASTEST) - weighting = weightingMethod = VAL_FASTEST; + String weighting = VAL_RECOMMENDED; + String weightingMethod = VAL_RECOMMENDED; if(requestWeighting == WeightingMethod.SHORTEST) weighting = weightingMethod = VAL_SHORTEST; //For a requested recommended weighting, use recommended for bike, walking and hgv. Use fastest for car. - if(requestWeighting == WeightingMethod.RECOMMENDED){ - if(RoutingProfileType.isCycling(profileType) || RoutingProfileType.isWalking(profileType)){ - weighting = VAL_RECOMMENDED; - weightingMethod = VAL_RECOMMENDED; + if (requestWeighting == WeightingMethod.RECOMMENDED || requestWeighting == WeightingMethod.FASTEST) { + if (profileType == RoutingProfileType.DRIVING_CAR) { + weighting = weightingMethod = VAL_FASTEST; } - if(RoutingProfileType.isHeavyVehicle(profileType)) { + else if (RoutingProfileType.isHeavyVehicle(profileType)) { weighting = VAL_RECOMMENDED; weightingMethod = VAL_RECOMMENDED_PREF; } + if (RoutingProfileType.isCycling(profileType) || RoutingProfileType.isWalking(profileType)){ + weighting = VAL_RECOMMENDED; + weightingMethod = VAL_RECOMMENDED; + } + } - req.setWeighting(weighting); - req.getHints().put(KEY_WEIGHTING_METHOD, weightingMethod); + map.put(KEY_WEIGHTING, weighting); + map.put(KEY_WEIGHTING_METHOD, weightingMethod); } /** * Set the speedup techniques used for calculating the route. diff --git a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreAlgoFactoryDecorator.java b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreAlgoFactoryDecorator.java index f89b650f6c..e6419d6630 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreAlgoFactoryDecorator.java +++ b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreAlgoFactoryDecorator.java @@ -75,11 +75,11 @@ public void init(CmdArgs args) { setPreparationThreads(args.getInt(Core.PREPARE + "threads", getPreparationThreads())); - // default is enabled & fastest + // default is enabled & recommended String coreWeightingsStr = args.get(Core.PREPARE + "weightings", ""); if ("no".equals(coreWeightingsStr)) { - // default is fastest and we need to clear this explicitely + // default is recommended and we need to clear this explicitely chProfileStrings.clear(); } else if (!coreWeightingsStr.isEmpty()) { setCHProfilesAsStrings(Arrays.asList(coreWeightingsStr.split(","))); @@ -236,7 +236,7 @@ public CoreAlgoFactoryDecorator addCHProfileAsString(String profileString) { } private String getDefaultProfile() { - return chProfileStrings.isEmpty() ? "fastest" : chProfileStrings.iterator().next(); + return chProfileStrings.isEmpty() ? "recommended" : chProfileStrings.iterator().next(); } public List getPreparations() { diff --git a/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestParser.java b/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestParser.java index 4dad3922b6..2ac3e37047 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestParser.java +++ b/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestParser.java @@ -91,7 +91,7 @@ public static MatrixRequest parseFromStream(InputStream stream) throws Exception int weightingMethod = WeightingMethod.getFromString(value); if (weightingMethod == WeightingMethod.UNKNOWN) throw new UnknownParameterValueException(MatrixErrorCodes.INVALID_PARAMETER_VALUE, KEY_PREFERENCE, value); - req.setWeightingMethod(value); + req.setWeightingMethod(weightingMethod); } @@ -218,7 +218,7 @@ public static MatrixRequest parseFromRequestParams(HttpServletRequest request) t if (weightingMethod == WeightingMethod.UNKNOWN) throw new UnknownParameterValueException(MatrixErrorCodes.INVALID_PARAMETER_VALUE, KEY_PREFERENCE, value); - req.setWeightingMethod(value); + req.setWeightingMethod(weightingMethod); } Coordinate[] locations = null; diff --git a/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestProcessor.java b/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestProcessor.java index 9d1a3501eb..4c115a08d9 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestProcessor.java +++ b/openrouteservice/src/main/java/org/heigit/ors/services/matrix/requestprocessors/json/JsonMatrixRequestProcessor.java @@ -23,6 +23,7 @@ import org.heigit.ors.matrix.*; import org.heigit.ors.routing.RoutingProfileManager; import org.heigit.ors.routing.RoutingProfileType; +import org.heigit.ors.routing.WeightingMethod; import org.heigit.ors.services.matrix.MatrixServiceSettings; import org.heigit.ors.servlet.http.AbstractHttpRequestProcessor; import org.heigit.ors.servlet.util.ServletUtility; @@ -97,8 +98,8 @@ private void writeResponse(HttpServletResponse response, MatrixRequest request, if (request.getUnits() != null) jQuery.put("units", DistanceUnitUtil.toString(request.getUnits())); - if (request.getWeightingMethod() != null) - jQuery.put("preference", request.getWeightingMethod()); + if (request.getWeightingMethod() != WeightingMethod.UNKNOWN) + jQuery.put("preference", WeightingMethod.getName(request.getWeightingMethod())); if (request.getId() != null) jQuery.put("id", request.getId()); diff --git a/openrouteservice/src/main/resources/app.config.sample b/openrouteservice/src/main/resources/app.config.sample index 74fb193875..82de351ede 100644 --- a/openrouteservice/src/main/resources/app.config.sample +++ b/openrouteservice/src/main/resources/app.config.sample @@ -77,7 +77,7 @@ "lm": { "enabled": true, "threads": 1, - "weightings": "fastest,shortest", + "weightings": "recommended,shortest", "landmarks": 16 } } @@ -164,18 +164,18 @@ "ch": { "enabled": true, "threads": 1, - "weightings": "fastest" + "weightings": "recommended" }, "lm": { "enabled": true, "threads": 1, - "weightings": "fastest,shortest", + "weightings": "recommended,shortest", "landmarks": 16 }, "core": { "enabled": true, "threads": 1, - "weightings": "fastest,shortest", + "weightings": "recommended,shortest", "landmarks": 64, "lmsets": "highways;allow_all" } diff --git a/openrouteservice/src/test/java/org/heigit/ors/api/requests/matrix/MatrixRequestHandlerTest.java b/openrouteservice/src/test/java/org/heigit/ors/api/requests/matrix/MatrixRequestHandlerTest.java index 85b0c741d8..0126640fe0 100644 --- a/openrouteservice/src/test/java/org/heigit/ors/api/requests/matrix/MatrixRequestHandlerTest.java +++ b/openrouteservice/src/test/java/org/heigit/ors/api/requests/matrix/MatrixRequestHandlerTest.java @@ -9,6 +9,7 @@ import org.heigit.ors.matrix.MatrixMetricsType; import org.heigit.ors.matrix.MatrixRequest; import org.heigit.ors.routing.RoutingProfileType; +import org.heigit.ors.routing.WeightingMethod; import org.heigit.ors.services.matrix.MatrixServiceSettings; import org.heigit.ors.util.HelperFunctions; import org.junit.Assert; @@ -96,7 +97,7 @@ public void convertMatrixRequestTest() throws StatusCodeException { Assert.assertEquals(3, matrixRequest.getSources().length); Assert.assertEquals(3, matrixRequest.getDestinations().length); Assert.assertEquals(1, matrixRequest.getMetrics()); - Assert.assertNull(matrixRequest.getWeightingMethod()); + Assert.assertEquals(WeightingMethod.UNKNOWN, matrixRequest.getWeightingMethod()); Assert.assertEquals(DistanceUnit.METERS, matrixRequest.getUnits()); Assert.assertFalse(matrixRequest.getResolveLocations()); Assert.assertFalse(matrixRequest.getFlexibleMode());