Skip to content

Commit 4998718

Browse files
authored
Move vehicle encoded values into custom model (graphhopper#2938)
1 parent bee3fc8 commit 4998718

File tree

118 files changed

+1885
-2382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1885
-2382
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
### 9.0 [not yet released]
22

3+
- removed shortest+fastest weightings, #2938
4+
- u_turn_costs information is no longer stored in profile. Use the TurnCostsConfig instead
5+
- the custom models do no longer include the speed, access and priority encoded values only implicitly, see docs/migration/config-migration-08-09.md
36
- conditional access restriction tags are no longer considered from vehicle tag parsers and instead a car_road_access_conditional encoded value (similarly for bike + foot) can be used in a custom model. This fixes #2477. More details are accessible via path details "access_conditional" (i.e. converted from OSM access:conditional). See #2863
47
- replaced (Vehicle)EncodedValueFactory and (Vehicle)TagParserFactory with ImportRegistry, #2935
58
- encoded values used in custom models are added automatically, no need to add them to graph.encoded_values anymore, #2935

benchmark/very_custom.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// this is a heavily customized model used to benchmark routing with a custom weighting
22
{
33
"speed": [
4+
{ "if": "true", "limit_to": "car_average_speed" },
45
{ "if": "road_class == MOTORWAY", "multiply_by": "0.85" },
56
{ "else_if": "road_class == PRIMARY", "multiply_by": "0.9" },
67
{ "if": "true", "limit_to": "110" }
78
],
89
"priority": [
10+
{ "if": "!car_access", "multiply_by": "0" },
911
{ "if": "road_access == PRIVATE", "multiply_by": "0" },
1012
{ "if": "max_height < 3.8", "multiply_by": "0" },
1113
{ "if": "max_width < 2.5", "multiply_by": "0" },
@@ -14,4 +16,4 @@
1416
{ "if": "toll != NO", "multiply_by": "0.5" },
1517
{ "if": "hazmat == NO", "multiply_by": "0" }
1618
]
17-
}
19+
}

config-example.yml

+21-25
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ graphhopper:
1414
#
1515
# In general a profile consists of the following
1616
# - name (required): a unique string identifier for the profile
17-
# - vehicle (required): refers to the `graph.vehicles` used for this profile
18-
# - weighting (required): the weighting used for this profile like custom
19-
# - turn_costs (true/false, default: false): whether or not turn restrictions should be applied for this profile.
17+
# - weighting (optional): by default 'custom'
18+
# - turn_costs (optional):
19+
# vehicle_types: [motorcar, motor_vehicle] (vehicle types used for vehicle-specific turn restrictions)
20+
# u_turn_costs: 60 (time-penalty for doing a u-turn in seconds)
2021
#
2122
# Depending on the above fields there are other properties that can be used, e.g.
22-
# - u_turn_costs: 60 (time-penalty for doing a u-turn in seconds (only possible when `turn_costs: true`)).
2323
# - custom_model_files: when you specified "weighting: custom" you need to set one or more json files which are searched in
2424
# custom_models.directory or the working directory that defines the custom_model. If you want an empty model you can
2525
# set "custom_model_files: []
@@ -29,24 +29,30 @@ graphhopper:
2929
# profiles (see below). Or at least limit the number of `routing.max_visited_nodes`.
3030

3131
profiles:
32-
- name: car
33-
vehicle: car
34-
custom_model:
35-
distance_influence: 70
36-
# turn_costs: true
37-
# u_turn_costs: 60
38-
32+
- name: car
33+
# turn_costs:
34+
# vehicle_types: [motorcar, motor_vehicle]
35+
# u_turn_costs: 60
36+
custom_model_files: [car.json]
37+
38+
# - name: foot
39+
# custom_model_files: [foot.json, foot_elevation.json]
40+
#
3941
# - name: bike
40-
# # to use the bike vehicle make sure to not ignore cycleways etc., see import.osm.ignored_highways below
41-
# vehicle: bike
4242
# custom_model_files: [bike.json, bike_elevation.json]
43+
#
44+
# - name: racingbike
45+
# custom_model_files: [racingbike.json, bike_elevation.json]
46+
#
47+
# - name: mtb
48+
# custom_model_files: [mtb.json, bike_elevation.json]
4349

4450
# instead of the inbuilt custom models (see ./core/src/main/resources/com/graphhopper/custom_models)
4551
# you can specify a folder where to find your own custom model files
4652
# custom_models.directory: custom_models
4753

4854
# Speed mode:
49-
# Its possible to speed up routing by doing a special graph preparation (Contraction Hierarchies, CH). This requires
55+
# It's possible to speed up routing by doing a special graph preparation (Contraction Hierarchies, CH). This requires
5056
# more RAM/disk space for holding the prepared graph but also means less memory usage per request. Using the following
5157
# list you can define for which of the above routing profiles such preparation shall be performed. Note that to support
5258
# profiles with `turn_costs: true` a more elaborate preparation is required (longer preparation time and more memory
@@ -66,15 +72,6 @@ graphhopper:
6672
profiles_lm: []
6773

6874

69-
#### Vehicles ####
70-
71-
# The vehicle defines the base for how the routing of a profile behaves. It can be adjusted with the turn_costs=true
72-
# option or, only for the roads vehicle, there is the transportation_mode option:
73-
# name=mycustomvehicle,turn_costs=true,transportation_mode=MOTOR_VEHICLE
74-
# But you should prefer to configure the turn_costs via the profile configuration.
75-
# Other standard vehicles: foot,bike,mtb,racingbike
76-
77-
7875
#### Encoded Values ####
7976

8077
# Add additional information to every edge. Used for path details (#1548) and custom models (docs/core/custom-models.md)
@@ -163,7 +160,6 @@ graphhopper:
163160
prepare.min_network_size: 200
164161
prepare.subnetworks.threads: 1
165162

166-
167163
#### Routing ####
168164

169165
# You can define the maximum visited nodes when routing. This may result in not found connections if there is no
@@ -201,7 +197,7 @@ graphhopper:
201197
#### Custom Areas ####
202198

203199
# GraphHopper reads GeoJSON polygon files including their properties from this directory and makes them available
204-
# to all tag parsers, vehicles and custom models. All GeoJSON Features require to have the "id" property.
200+
# to all tag parsers and custom models. All GeoJSON Features require to have the "id" property.
205201
# Country borders are included automatically (see countries.geojson).
206202
# custom_areas.directory: path/to/custom_areas
207203

0 commit comments

Comments
 (0)