Skip to content

Commit 36ffac9

Browse files
committed
bike: reduce elevation influence
1 parent 58490e8 commit 36ffac9

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

core/src/test/java/com/graphhopper/routing/RoutingAlgorithmWithOSMTest.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,21 +332,21 @@ public void testHikeCanUseExtremeSacScales() {
332332
public void testMonacoBike3D() {
333333
List<Query> queries = new ArrayList<>();
334334
// 1. alternative: go over steps 'Rampe Major' => 1.7km vs. around 2.7km
335-
queries.add(new Query(43.730864, 7.420771, 43.727687, 7.418737, 2670, 118));
335+
queries.add(new Query(43.730864, 7.420771, 43.727687, 7.418737, 2689, 118));
336336
// 2.
337-
queries.add(new Query(43.728499, 7.417907, 43.74958, 7.436566, 4250, 220));
337+
queries.add(new Query(43.728499, 7.417907, 43.74958, 7.436566, 3723, 174));
338338
// 3.
339-
queries.add(new Query(43.728677, 7.41016, 43.739213, 7.427806, 2776, 167));
339+
queries.add(new Query(43.728677, 7.41016, 43.739213, 7.427806, 2768, 132));
340340
// 4.
341-
queries.add(new Query(43.733802, 7.413433, 43.739662, 7.424355, 1593, 85));
341+
queries.add(new Query(43.733802, 7.413433, 43.739662, 7.424355, 1826, 127));
342342

343343
// try reverse direction
344344
// 1.
345-
queries.add(new Query(43.727687, 7.418737, 43.730864, 7.420771, 2788, 116));
346-
queries.add(new Query(43.74958, 7.436566, 43.728499, 7.417907, 4132, 194));
347-
queries.add(new Query(43.739213, 7.427806, 43.728677, 7.41016, 2805, 145));
345+
queries.add(new Query(43.727687, 7.418737, 43.730864, 7.420771, 2766, 138));
346+
queries.add(new Query(43.74958, 7.436566, 43.728499, 7.417907, 4918, 285));
347+
queries.add(new Query(43.739213, 7.427806, 43.728677, 7.41016, 3581, 187));
348348
// 4. avoid tunnel(s)!
349-
queries.add(new Query(43.739662, 7.424355, 43.733802, 7.413433, 1723, 96));
349+
queries.add(new Query(43.739662, 7.424355, 43.733802, 7.413433, 2293, 132));
350350
// atm the custom model is intended to be used with 'roads' vehicle when allowing reverse direction for oneways
351351
// but tests here still assert that reverse oneways are excluded
352352
GraphHopper hopper = createHopper(MONACO,
@@ -590,10 +590,22 @@ public void testNeudrossenfeld() {
590590
hopper.setElevationProvider(new SRTMProvider(DIR));
591591
hopper.importOrLoad();
592592
checkQueries(hopper, list);
593-
594593
}
595594

596595
@Test
596+
public void testBikeBayreuth_UseBikeNetwork() {
597+
List<Query> list = new ArrayList<>();
598+
list.add(new Query(49.979667,11.521019, 49.987415,11.510577, 1403, 45));
599+
600+
GraphHopper hopper = createHopper(BAYREUTH, new CustomProfile("bike").setCustomModel(
601+
CustomModel.merge(getCustomModel("bike.json"), getCustomModel("bike_elevation.json"))).setVehicle("roads"));
602+
hopper.setVehiclesString("bike,roads");
603+
hopper.setElevationProvider(new SRTMProvider(DIR));
604+
hopper.importOrLoad();
605+
checkQueries(hopper, list);
606+
}
607+
608+
@Test
597609
public void testDisconnectedAreaAndMultiplePoints() {
598610
Query query = new Query();
599611
query.add(53.753177, 9.435968, 10, 10);

custom_models/bike_elevation.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"speed": [
3-
{ "if": "average_slope >= 15", "limit_to": "2"},
4-
{ "else_if": "average_slope >= 7", "limit_to": "4"},
5-
{ "else_if": "average_slope >= 4", "multiply_by": "0.85"},
6-
{ "else_if": "average_slope <= -4", "multiply_by": "1.15"}
3+
{ "if": "average_slope >= 15", "limit_to": "6"},
4+
{ "else_if": "average_slope >= 7", "limit_to": "0.80"},
5+
{ "else_if": "average_slope >= 4", "multiply_by": "0.90"},
6+
{ "else_if": "average_slope <= -4", "multiply_by": "1.10"}
77
]
88
}

0 commit comments

Comments
 (0)