Skip to content

Commit aa71dc2

Browse files
authored
Remove block area (graphhopper#2741)
1 parent f6b1a1b commit aa71dc2

17 files changed

Lines changed: 95 additions & 637 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- internal keys for EdgeKVStorage changed to contain the street_ prefix like the path details too. Similarly, the
1313
extra_info in the instructions of the API response, see #2661
1414
- subnetwork preparation can now be run in parallel to slightly speed up the base graph import (#2737)
15+
- The block_area parameter was removed. Use custom model areas instead.
1516

1617
### 6.0 [13 Sep 2022]
1718

benchmark/benchmark.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ graph.location=${GRAPH_DIR}measurement-small-gh \
6161
prepare.min_network_size=10000 \
6262
measurement.json=true \
6363
measurement.count=5000 \
64-
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
65-
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
64+
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}
6665

6766
echo "2 - big map: node-based CH + landmarks (edge- & node-based for LM) + slow routing"
6867
java -cp tools/target/graphhopper-tools-*-jar-with-dependencies.jar \
@@ -90,8 +89,7 @@ graph.location=${GRAPH_DIR}measurement-big-gh \
9089
prepare.min_network_size=10000 \
9190
measurement.json=true \
9291
measurement.count=5000 \
93-
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
94-
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
92+
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}
9593

9694
echo "3 - big map with a custom model that is 'a little customized', i.e. similar to the standard fastest-car profile"
9795
echo "node-based CH + LM"
@@ -122,8 +120,7 @@ graph.location=${GRAPH_DIR}measurement-big-little-custom-gh \
122120
prepare.min_network_size=10000 \
123121
measurement.json=true \
124122
measurement.count=5000 \
125-
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
126-
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
123+
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}
127124

128125
echo "4 - big map with a custom model that is 'very customized', i.e. has many custom weighting rules"
129126
echo "node-based CH + LM"
@@ -154,8 +151,7 @@ graph.location=${GRAPH_DIR}measurement-big-very-custom-gh \
154151
prepare.min_network_size=10000 \
155152
measurement.json=true \
156153
measurement.count=5000 \
157-
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
158-
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
154+
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}
159155

160156
echo "5 - big map, outdoor: node-based CH + landmarks (edge- & node-based for LM)"
161157
java -cp tools/target/graphhopper-tools-*-jar-with-dependencies.jar \
@@ -183,5 +179,4 @@ graph.location=${GRAPH_DIR}measurement-big-outdoor-gh \
183179
prepare.min_network_size=10000 \
184180
measurement.json=true \
185181
measurement.count=5000 \
186-
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
187-
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
182+
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}

core/src/main/java/com/graphhopper/routing/DefaultWeightingFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public Weighting createWeighting(Profile profile, PMap requestHints, boolean dis
5252
// Merge profile hints with request hints, the request hints take precedence.
5353
// Note that so far we do not check if overwriting the profile hints actually works with the preparation
5454
// for LM/CH. Later we should also limit the number of parameters that can be used to modify the profile.
55-
// todo: since we are not dealing with block_area here yet we cannot really apply any merging rules
56-
// for it, see discussion here: https://github.com/graphhopper/graphhopper/pull/1958#discussion_r395462901
5755
PMap hints = new PMap();
5856
hints.putAll(profile.getHints());
5957
hints.putAll(requestHints);

core/src/main/java/com/graphhopper/routing/Router.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@
3131
import com.graphhopper.routing.lm.LandmarkStorage;
3232
import com.graphhopper.routing.querygraph.QueryGraph;
3333
import com.graphhopper.routing.util.*;
34-
import com.graphhopper.routing.weighting.BlockAreaWeighting;
3534
import com.graphhopper.routing.weighting.Weighting;
3635
import com.graphhopper.routing.weighting.custom.CustomProfile;
3736
import com.graphhopper.routing.weighting.custom.FindMinMax;
3837
import com.graphhopper.storage.BaseGraph;
3938
import com.graphhopper.storage.Graph;
40-
import com.graphhopper.storage.GraphEdgeIdFinder;
4139
import com.graphhopper.storage.RoutingCHGraph;
4240
import com.graphhopper.storage.index.LocationIndex;
4341
import com.graphhopper.storage.index.Snap;
@@ -104,7 +102,7 @@ public GHResponse route(GHRequest request) {
104102
checkHeadings(request);
105103
checkPointHints(request);
106104
checkCurbsides(request);
107-
checkNoBlockAreaWithCustomModel(request);
105+
checkNoBlockArea(request);
108106

109107
Solver solver = createSolver(request);
110108
solver.checkRequest();
@@ -177,9 +175,9 @@ private void checkCurbsides(GHRequest request) {
177175
throw new IllegalArgumentException("If you pass " + CURBSIDE + ", you need to pass exactly one curbside for every point, empty curbsides will be ignored");
178176
}
179177

180-
private void checkNoBlockAreaWithCustomModel(GHRequest request) {
181-
if (request.getCustomModel() != null && request.getHints().has(BLOCK_AREA))
182-
throw new IllegalArgumentException("When using `custom_model` do not use `block_area`. Use `areas` in the custom model instead");
178+
private void checkNoBlockArea(GHRequest request) {
179+
if (request.getHints().has("block_area"))
180+
throw new IllegalArgumentException("The `block_area` parameter is no longer supported. Use a custom model with `areas` instead.");
183181
}
184182

185183
protected Solver createSolver(GHRequest request) {
@@ -428,9 +426,6 @@ protected void checkRequest() {
428426
if (getPassThrough(request.getHints()))
429427
throw new IllegalArgumentException("The '" + Parameters.Routing.PASS_THROUGH + "' parameter is currently not supported for speed mode, you need to disable speed mode with `ch.disable=true`. See issue #1765");
430428

431-
if (request.getHints().has(Parameters.Routing.BLOCK_AREA))
432-
throw new IllegalArgumentException("The '" + Parameters.Routing.BLOCK_AREA + "' parameter is currently not supported for speed mode, you need to disable speed mode with `ch.disable=true`.");
433-
434429
if (request.getCustomModel() != null)
435430
throw new IllegalArgumentException("The 'custom_model' parameter is currently not supported for speed mode, you need to disable speed mode with `ch.disable=true`.");
436431

@@ -492,13 +487,7 @@ protected void checkRequest() {
492487
protected Weighting createWeighting() {
493488
PMap requestHints = new PMap(request.getHints());
494489
requestHints.putObject(CustomModel.KEY, request.getCustomModel());
495-
Weighting weighting = weightingFactory.createWeighting(profile, requestHints, false);
496-
if (requestHints.has(Parameters.Routing.BLOCK_AREA)) {
497-
GraphEdgeIdFinder.BlockArea blockArea = GraphEdgeIdFinder.createBlockArea(baseGraph, locationIndex,
498-
request.getPoints(), requestHints, new FiniteWeightFilter(weighting));
499-
weighting = new BlockAreaWeighting(weighting, blockArea);
500-
}
501-
return weighting;
490+
return weightingFactory.createWeighting(profile, requestHints, false);
502491
}
503492

504493
@Override

core/src/main/java/com/graphhopper/routing/weighting/BlockAreaWeighting.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)