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

fix: remove elevation smoother #1511

Merged
merged 10 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ RELEASING:
- Centrality API and implementation (use export API and external centrality tools instead)
- workaround for springfox-swagger package & GroupedOpenApi builders ([#1504](https://github.com/GIScience/openrouteservice/pull/1504))
- wrong instanceof checks/casts for RoutingCHGraph ([#1504](https://github.com/GIScience/openrouteservice/pull/1504))
- ElevationSmoother
MichaelsJP marked this conversation as resolved.
Show resolved Hide resolved

### Fixed
- GTFS issues with old jts-core version used in GH ([#1501](https://github.com/GIScience/openrouteservice/pull/1501))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,19 +928,19 @@ void testCrossVirtualNode() {
.body("durations.size()", is(4))
.body("durations[0][0]", is(closeTo(0.0f, 0.1f)))
.body("durations[0][1]", is(closeTo(564.3f, 1.0f)))
.body("durations[0][2]", is(closeTo(1659.0f, 1.0f)))
.body("durations[0][3]", is(closeTo(1448.2f, 1.0f)))
.body("durations[0][2]", is(closeTo(1646.6f, 1.0f)))
.body("durations[0][3]", is(closeTo(1438.6f, 1.0f)))
.body("durations[1][0]", is(closeTo(513.8f, 1.0f)))
.body("durations[1][1]", is(closeTo(0.0f, 1.0f)))
.body("durations[1][2]", is(closeTo(1219.2, 1.0f)))
.body("durations[1][3]", is(closeTo(1008.3f, 1.0f)))
.body("durations[2][0]", is(closeTo(1631.7f, 1.0f)))
.body("durations[2][1]", is(closeTo(1212.6f, 1.0f)))
.body("durations[1][2]", is(closeTo(1206.56, 1.0f)))
.body("durations[1][3]", is(closeTo(998.59f, 1.0f)))
.body("durations[2][0]", is(closeTo(1619.28f, 1.0f)))
.body("durations[2][1]", is(closeTo(1200.08f, 1.0f)))
.body("durations[2][2]", is(closeTo(0.0f, 1.0f)))
.body("durations[2][3]", is(closeTo(210.5f, 1.0f)))
.body("durations[3][0]", is(closeTo(1420.9f, 1.0f)))
.body("durations[3][1]", is(closeTo(1001.8f, 1.0f)))
.body("durations[3][2]", is(closeTo(210.8f, 1.0f)))
.body("durations[2][3]", is(closeTo(207.97f, 1.0f)))
.body("durations[3][0]", is(closeTo(1411.31f, 1.0f)))
.body("durations[3][1]", is(closeTo(992.11f, 1.0f)))
.body("durations[3][2]", is(closeTo(207.97f, 1.0f)))
.body("durations[3][3]", is(closeTo(0.0f, 1.0f)))
.statusCode(200);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ public ResultTest() {

addParameter("coordinatesWalking", coordsFoot);

JSONArray coordsFootBridge = new JSONArray();
JSONArray coordFootBridge1 = new JSONArray();
coordFootBridge1.put(8.692013);
coordFootBridge1.put(49.415036);
coordsFootBridge.put(coordFootBridge1);
JSONArray coordFootBridge2 = new JSONArray();
coordFootBridge2.put( 8.692765);
coordFootBridge2.put(49.410540);
coordsFootBridge.put(coordFootBridge2);

addParameter("coordinatesWalkingBridge", coordsFootBridge);

JSONArray coordinatesPT = new JSONArray();
JSONArray coordinatesPTFlipped = new JSONArray();
JSONArray coordPT1 = new JSONArray();
Expand Down Expand Up @@ -767,10 +779,11 @@ void testSummary() { // waiting for elevation & turn restrictions
.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(closeTo(13079.0, 130)))
.body("routes[0].summary.duration", is(closeTo(2737.0, 27)))
.body("routes[0].summary.ascent", is(closeTo(351.0, 35)))
.body("routes[0].summary.descent", is(closeTo(347.6, 34)))
.body("routes[0].containsKey('summary')", is(true))
.body("routes[0].summary.containsKey('distance')", is(true))
.body("routes[0].summary.containsKey('duration')", is(true))
.body("routes[0].summary.containsKey('ascent')", is(true))
.body("routes[0].summary.containsKey('descent')", is(true))
.statusCode(200);
}

Expand Down Expand Up @@ -802,30 +815,6 @@ void testSegmentDistances() {
.statusCode(200);
}

@Test
void testEncodedPolyline() { // check if route is the same as before, then the value can be adjusted
// need to check if polyline generation is sufficiently covered by unit tests, then this test can be omitted
JSONObject body = new JSONObject();
body.put("coordinates", getParameter("coordinatesLong"));
body.put("preference", getParameter("preference"));
body.put("instructions", true);
body.put("elevation", true);

given()
.headers(CommonHeaders.jsonContent)
.pathParam("profile", getParameter("bikeProfile"))
.body(body.toString())
.when()
.post(getEndPointPath() + "/{profile}")
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body(
"routes[0].geometry",
is("gvqlHk`~s@cwUB?tC?Cp@NAdISgChAWiCeCcAuGL_@_GxKGQnAIeAxC?GhAGqA~DEsAf@Eu@g@CcAiAGqA_DEqAkCAOoAEcAaCEgAwB@Ww@QBu@IyAmBcAyGrASkCHEmBg@E{CHAa@HAgAeARCHHAHCqBt@BIJCoAVJQR@SXCkAv@ATT@RPAp@JK?DAw@f@dIuArFVBXB@XBDVTn@hBFJz@Xp@rBHDx@`@Ct@RGt@hB_A_BPGcA~Aw@uLVEwBN?kCb@LkCf@f@eIh@NsI^?iDt@EoK^E_BN?[JBINDI~BOnANAp@HN~@LEnAFCnANInAXOp@LAp@J[p@?Kp@?Up@DI?DK?@u@?DYHA{@R@YHBQHAg@HGg@HHNS`DVg@J@HbFnBwQtEbAiS`HbBfEtBv@mAv@ZwAnGrAcJLFGPDIL@BJNNVQ\\FI\\JI\\NOZRSXHIX`@YGp@W_@`@Y_@XYq@f@m@aBbB}@aMLUmBP]mALc@qAHe@oAH[oAJ[{ERWmFJI}En@i@sSZs@yKRu@{JHa@uHBo@qHAkCi|@@cAa]FqAk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ArBv]c@j@dSoCrB|~ACHzJAF~CDDjHn@AvQnAQvQFB\\DLg@APs@EJ}@UVlEg@\\zJy@XfN[LjC{@f@~RuBrBr`AUZvQ]t@nd@Qn@~R]dEr`AM~@vIIh@rDIPrDE@rDJpEbV?zBlC?rAbA@hCC?HIiBHKDrFtDBfAnARhDjFThCrD@Hb@Fn@^Fn@H@NFLvAFFnA]DvB]@Z??^?DnC]Bb@ILtFyABn@c@gDdAgBoHhBlh@K?~ASCvAGBnAO@hAUJdACB`A{I~A{Gk@HwCG?gAq@DeCKb@}@oDLaNqA@oD{@BgB{ADuBiCH}@O@H}AHtAa@RRsAxAfE_AfAfE[Xp@KAp@YD\\E@\\sBp@xCSH\\OJGIROgAb@gCq@\\wBmAt@}Ay@f@g@_DnAkA_@L?mBn@v@c@NR{C`AdA_DfA]uAf@{BYTYG@WGCWINUCGSUDS"))
.statusCode(200);
}

@Test
void testWaypoints() {
JSONObject body = new JSONObject();
Expand All @@ -848,7 +837,7 @@ void testWaypoints() {
}

@Test
void testBbox() { // wait for elevation smoothing check, rewrite coordinates as closeTo
void testBbox() {
JSONObject body = new JSONObject();
body.put("coordinates", getParameter("coordinatesLong"));
body.put("preference", getParameter("preference"));
Expand All @@ -865,7 +854,7 @@ void testBbox() { // wait for elevation smoothing check, rewrite coordinates as
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].bbox", hasItems(closeTo(8.678615, 0.1), closeTo(49.388405, 0.5), closeTo(107.83, 1), closeTo(8.719662, 0.1), closeTo(49.424603, 0.5), closeTo(404.73, 4)))
.body("routes[0].bbox", hasItems(closeTo(8.678615,0.1), closeTo(49.388405,0.5), closeTo(106.83,1), closeTo(8.719662,0.1), closeTo(49.424603,0.5), closeTo(411.73,4)))
.statusCode(200);
}

Expand All @@ -888,7 +877,7 @@ void testManeuver() {
.then().log().ifValidationFails()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].bbox", hasItems(closeTo(8.678615, 0.1), closeTo(49.388405f, 0.5), closeTo(107.83f, 1), closeTo(8.719662f, 0.1), closeTo(49.424603f, 0.5), closeTo(404.73f, 4)))
.body("routes[0].bbox", hasItems(closeTo(8.678615,0.1), closeTo(49.388405f,0.5), closeTo(106.83f, 1), closeTo(8.719662f, 0.1), closeTo(49.424603f,0.5), closeTo(411.73f, 4)))
.body("routes[0].segments[0].steps[0].maneuver.bearing_before", is(0))
.body("routes[0].segments[0].steps[0].maneuver.bearing_after", is(175))
.body("routes[0].segments[0].steps[0].maneuver.containsKey('location')", is(true))
Expand Down Expand Up @@ -945,7 +934,7 @@ void testExtrasDetails() {
.body("routes[0].extras.surface.values.size()", is(38))
.body("routes[0].extras.surface.values[18][1]", is(181))
.body("routes[0].extras.suitability.values[18][0]", is(359))
.body("routes[0].extras.steepness.values[10][1]", is(220))
.body("routes[0].extras.containsKey('steepness')", is(true))
.statusCode(200);

checkExtraConsistency(response);
Expand Down Expand Up @@ -1447,7 +1436,7 @@ void testContinueStraightNoBearings() {
.then().log().ifValidationFails()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(closeTo(15173.0, 15)))
.body("routes[0].summary.distance", is(closeTo(15173.0, 150)))
.statusCode(200);
}

Expand Down Expand Up @@ -2444,7 +2433,6 @@ void testSkipSegments() {
.body("routes[0].summary.distance", is(1744.3f))
.body("routes[0].containsKey('geometry')", is(true))
.body("routes[0].containsKey('way_points')", is(true))
.body("routes[0].geometry", is("gvqlHi`~s@ooAix@"))
.body("routes[0].way_points[0]", is(0))
.body("routes[0].way_points[1]", is(1))
.body("routes[0].segments[0].steps[0].distance", is(1744.3f))
Expand Down Expand Up @@ -2536,14 +2524,6 @@ void testSkipSegments() {
.body("routes[0].summary.distance", is(closeTo(10936.3, 10)))
.body("routes[0].containsKey('geometry')", is(true))
.body("routes[0].containsKey('way_points')", is(true))
// .body("routes[0].geometry", is("gvqlHi`~s@hrBw`Fq@lAiEf@qEn@wH^[@i@BqAEuDu@qASgACi@B_BRs@N]L]" +
// "X_A~@IJEFEBGFCBODSEUYMg@yAeKGq@O{CS{Bk@sEk@uDYkAGOSMK?IBIHGJQXg@p@cA`A_@f@MVIPs@pA_@j@GLEFg@j@" +
// "gA~@k@v@KRMTo@tA_@lAa@fBW`B?J?D@DJFD?FC\\oAVk@l@q@z@a@|@Sn@Br@XZPPRHN@FDVARU`AStAGb@If@Ib@Q~@[" +
// "fBm@dEEt@Ar@FbCCjBEl@O~@Kd@EPEROx@Kf@Sv@Sf@GPGPOZGDICCS?A@Ab@uA@G?C@m@OoAEy@?i@?SAm@EQEAEBQZKTC" +
// "FGLKTm@rAEHEF]b@oCrBEN?@?@BB@?@@bAGz@MDBBH@JCLY^g@\\g@PQFIBcAh@_BzA_@^CBSV[t@Oh@G\\WlDKr@AJIh@I" +
// "PE@JpE?d@?tA?rA?v@?n@@`@?HHfAJfARjB@TPdBJdAT|BBPDh@BNDZFr@D`@b@pEBVP~ARnBBLZxCD\\JhA@T[H_@HQFw@V" +
// "eBh@m@NgAXo@PsA`@QDSFcBf@{@X_@LKBO@M@Y@C?[BmJ`Be@ROFO?qADqAFK?I@gA?{@Bk@@o@BiCHO@C?k@@m@HOD]VgA" +
// "lA_AfAUREDC?Q?OBE@qBn@A@SHOJELCDgAb@q@\\mAt@y@f@y@XeBt@YJsBp@c@N{C`A_DfAuAf@MHKJQVEEACCGI?KB"))
.body("routes[0].way_points[0]", is(0))
.body("routes[0].way_points[1]", is(1))
.body("routes[0].segments[0].steps[0].distance", is(closeTo(4499.5, 5)))
Expand Down Expand Up @@ -3311,6 +3291,7 @@ void testWaypointCount() {
}

@Test
@Disabled("Should be tested with unit test")
void expectNoInterpolationOfBridgesAndTunnels() { // consider rewriting as unit test
// wait for elevation smoothing check
JSONObject body = new JSONObject();
Expand All @@ -3334,28 +3315,6 @@ void expectNoInterpolationOfBridgesAndTunnels() { // consider rewriting as unit
.statusCode(200);
}

@Test
void expectElevationSmoothing() {
JSONObject body = new JSONObject();
body.put("coordinates", getParameter("coordinatesShort"));
body.put("preference", getParameter("preference"));
body.put("elevation", true);

given()
.headers(CommonHeaders.jsonContent)
.pathParam("profile", "foot-hiking")
.body(body.toString())
.when()
.post(getEndPointPath() + "/{profile}")
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(2002.1f))
.body("routes[0].summary.ascent", is(7.1f))
.body("routes[0].summary.descent", is(6.6f))
.statusCode(200);
}

@Test
void expectDepartureAndArrival() {
JSONObject body = new JSONObject();
Expand Down Expand Up @@ -3729,6 +3688,7 @@ void expectMaxpeedHgvForward() {

// Test that "maxspeed:hgv:forward = 30" when going downhill on Am Götzenberg is taken into account for hgv profile
given()
.config(JSON_CONFIG_DOUBLE_NUMBERS)
.headers(CommonHeaders.jsonContent)
.pathParam("profile", getParameter("carProfile"))
.body(body.toString())
Expand All @@ -3737,11 +3697,12 @@ void expectMaxpeedHgvForward() {
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(497.5f))
.body("routes[0].summary.duration", is(61.9f))
.body("routes[0].summary.distance", is(closeTo(497.5f,4)))
.body("routes[0].summary.duration", is(closeTo(61.9f, 0.6)))
.statusCode(200);

given()
.config(JSON_CONFIG_DOUBLE_NUMBERS)
.headers(CommonHeaders.jsonContent)
.pathParam("profile", "driving-hgv")
.body(body.toString())
Expand All @@ -3750,8 +3711,8 @@ void expectMaxpeedHgvForward() {
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(497.5f))
.body("routes[0].summary.duration", is(81.1f))
.body("routes[0].summary.distance", is(closeTo(497.5f,4)))
.body("routes[0].summary.duration", is(closeTo(81.1f,0.8)))
.statusCode(200);
}

Expand Down
2 changes: 1 addition & 1 deletion ors-api/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ors:
cache_path: ./src/test/files/elevation
profile_default:
elevation: true
elevation_smoothing: true
encoder_flags_size: 4
maximum_snapping_radius: 350
preparation:
Expand Down Expand Up @@ -221,7 +222,6 @@ ors:
TrailDifficulty:
hiking:
profile: foot-hiking
elevation_smoothing: true
encoder_options:
block_fords: false
ext_storages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.heigit.ors.routing.graphhopper.extensions.storages.*;
import org.heigit.ors.routing.graphhopper.extensions.util.PriorityCode;
import org.heigit.ors.routing.parameters.ProfileParameters;
import org.heigit.ors.routing.util.ElevationSmoother;
import org.heigit.ors.routing.util.WaySurfaceDescription;
import org.heigit.ors.routing.util.extrainfobuilders.AppendableRouteExtraInfoBuilder;
import org.heigit.ors.routing.util.extrainfobuilders.AppendableSteepnessExtraInfoBuilder;
Expand Down Expand Up @@ -538,13 +537,10 @@ public void processPathEdge(EdgeIteratorState edge, PointList geom) {
public PointList processPoints(PointList points) {
PointList result = points;

if (points.is3D())
result = ElevationSmoother.smooth(points);

if (steepnessInfoBuilder != null) {
// compute steepness information only after elevation data is smoothed.
steepnessInfoBuilder.addPoints(result);
}
if (steepnessInfoBuilder != null) {
// compute steepness information only after elevation data is smoothed.
steepnessInfoBuilder.addPoints(result);
}

return result;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static String encode(final Coordinate[] coords, boolean includeElevation,
encode(lat - prevLat, buffer);
encode(lon - prevLon, buffer);

// Note that encoding elevation is not supported by the official polyline encoding
if (includeElevation) {
elev = (long) Math.floor(c.z * 100);
encode(elev - prevEle, buffer);
Expand Down
Loading