From 5dde9aceb56841e5acf0b11ab57521058f09863e Mon Sep 17 00:00:00 2001 From: Sachin Goel Date: Mon, 23 Dec 2024 15:11:38 -0800 Subject: [PATCH 1/2] feat: remove unused costing models This PR removes unused costing models from being taken in to consideration when building tiles. It also prevents them from being used when making routing requests. --- config.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/config.yml b/config.yml index 14e9cbb..3004295 100644 --- a/config.yml +++ b/config.yml @@ -29,36 +29,12 @@ graphhopper: # profiles (see below). Or at least limit the number of `routing.max_visited_nodes`. profiles: - - name: tgv_all - turn_costs: - vehicle_types: [train] - # Reversing costs 5 minutes. - u_turn_costs: 300 - custom_model_files: [rail.json, tgv_all.json, preferred_direction.json] - - name: non_tgv - turn_costs: - vehicle_types: [train] - # Reversing costs 15 minutes. - u_turn_costs: 900 - custom_model_files: [rail.json, non_tgv.json, preferred_direction.json] - - name: tramtrain - turn_costs: - vehicle_types: [train, tram, light_rail] - # Reversing costs 3 minutes. - u_turn_costs: 180 - custom_model_files: [tramtrain.json, 15kv-ac_750v-dc.json, gauge_1435.json, preferred_direction.json] - name: all_tracks turn_costs: vehicle_types: [train, tram, light_rail, subway] # Reversing costs 3 minutes. u_turn_costs: 180 custom_model_files: [all_tracks.json] - - name: all_tracks_1435 - turn_costs: - vehicle_types: [train, tram, light_rail, subway] - # Reversing costs 3 minutes. - u_turn_costs: 180 - custom_model_files: [all_tracks.json, gauge_1435.json] # instead of the inbuilt custom models (see ./src/main/resources/com/graphhopper/custom_models) # you can specify a folder where to find your own custom model files @@ -71,11 +47,7 @@ graphhopper: # profiles with `turn_costs: true` a more elaborate preparation is required (longer preparation time and more memory # usage) and the routing will also be slower than with `turn_costs: false`. profiles_ch: - - profile: tgv_all - - profile: non_tgv - - profile: tramtrain - profile: all_tracks - - profile: all_tracks_1435 # Hybrid mode: # Similar to speed mode, the hybrid mode (Landmarks, LM) also speeds up routing by doing calculating auxiliary data From a8c6bd157b64041fe7d571b6f72e8be7750813b2 Mon Sep 17 00:00:00 2001 From: Sachin Goel Date: Mon, 23 Dec 2024 15:17:33 -0800 Subject: [PATCH 2/2] feat: remove costing profiles json definitions --- .../custom_models/15kv-ac_750v-dc.json | 10 -------- .../graphhopper/custom_models/gauge_1435.json | 12 ---------- .../graphhopper/custom_models/non_tgv.json | 19 --------------- .../custom_models/preferred_direction.json | 15 ------------ .../com/graphhopper/custom_models/rail.json | 16 ------------- .../graphhopper/custom_models/tgv_all.json | 24 ------------------- .../graphhopper/custom_models/tramtrain.json | 18 -------------- 7 files changed, 114 deletions(-) delete mode 100644 src/main/resources/com/graphhopper/custom_models/15kv-ac_750v-dc.json delete mode 100644 src/main/resources/com/graphhopper/custom_models/gauge_1435.json delete mode 100644 src/main/resources/com/graphhopper/custom_models/non_tgv.json delete mode 100644 src/main/resources/com/graphhopper/custom_models/preferred_direction.json delete mode 100644 src/main/resources/com/graphhopper/custom_models/rail.json delete mode 100644 src/main/resources/com/graphhopper/custom_models/tgv_all.json delete mode 100644 src/main/resources/com/graphhopper/custom_models/tramtrain.json diff --git a/src/main/resources/com/graphhopper/custom_models/15kv-ac_750v-dc.json b/src/main/resources/com/graphhopper/custom_models/15kv-ac_750v-dc.json deleted file mode 100644 index bbf5cdc..0000000 --- a/src/main/resources/com/graphhopper/custom_models/15kv-ac_750v-dc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "distance_influence": 0, - "speed": [ - { "if": "!(electrified == CONTACT_LINE || electrified == UNSET)", "multiply_by": "0.0" }, - { "else_if": "voltage >= 14000.0 && voltage <= 16000.0 && frequency >= 15.0 && frequency <= 17.5", "limit_to": "100" }, - { "else_if": "voltage >= 700.0 && voltage <= 800.0 && frequency == 0.0", "limit_to": "100" }, - { "else_if": "voltage == 0.0 && frequency == 0.0", "limit_to": "100" }, - { "else": "", "multiply_by": "0.0" } - ] -} diff --git a/src/main/resources/com/graphhopper/custom_models/gauge_1435.json b/src/main/resources/com/graphhopper/custom_models/gauge_1435.json deleted file mode 100644 index 5fdded2..0000000 --- a/src/main/resources/com/graphhopper/custom_models/gauge_1435.json +++ /dev/null @@ -1,12 +0,0 @@ -// to use this custom model you need to set the following option in the config.yml -// profiles: -// - name: rail -// turn_costs: -// vehicle_types: [] -// custom_model_files: [rail.json] - -{ - "speed": [ - { "if": "gauge != 0 && gauge != 1435", "multiply_by": "0.0" } - ] -} diff --git a/src/main/resources/com/graphhopper/custom_models/non_tgv.json b/src/main/resources/com/graphhopper/custom_models/non_tgv.json deleted file mode 100644 index e014b2d..0000000 --- a/src/main/resources/com/graphhopper/custom_models/non_tgv.json +++ /dev/null @@ -1,19 +0,0 @@ -// to use this custom model you need to set the following option in the config.yml -// profiles: -// - name: rail -// turn_costs: -// vehicle_types: [] -// custom_model_files: [rail.json, non_tgv.json] - -// This model represents a diesel-powered train. -// maximum speed: 120 km/h - -{ - "distance_influence": 0, - "priority": [ - { "if": "!rail_access", "multiply_by": "0" } - ], - "speed": [ - { "if": "true", "limit_to": "120" } - ] -} diff --git a/src/main/resources/com/graphhopper/custom_models/preferred_direction.json b/src/main/resources/com/graphhopper/custom_models/preferred_direction.json deleted file mode 100644 index a09ae50..0000000 --- a/src/main/resources/com/graphhopper/custom_models/preferred_direction.json +++ /dev/null @@ -1,15 +0,0 @@ -// to use this custom model you need to set the following option in the config.yml -// profiles: -// - name: rail -// turn_costs: -// vehicle_types: [] -// custom_model_files: [preferred_direction.json] - -// This model adds support for railway:preferred_direction=* tags. Routing requests (not map matching) -// will avoid to use tracks against their tagged preferred direction. - -{ - "priority": [ - { "if": "!preferred_direction", "multiply_by": "0.7" } - ] -} diff --git a/src/main/resources/com/graphhopper/custom_models/rail.json b/src/main/resources/com/graphhopper/custom_models/rail.json deleted file mode 100644 index d724fd8..0000000 --- a/src/main/resources/com/graphhopper/custom_models/rail.json +++ /dev/null @@ -1,16 +0,0 @@ -// to use this custom model you need to set the following option in the config.yml -// profiles: -// - name: rail -// turn_costs: -// vehicle_types: [] -// custom_model_files: [rail.json] - -{ - "distance_influence": 0, - "priority": [ - { "if": "!rail_access || railway_class != RAIL", "multiply_by": "0" } - ], - "speed": [ - { "if": "true", "limit_to": "rail_average_speed" } - ] -} diff --git a/src/main/resources/com/graphhopper/custom_models/tgv_all.json b/src/main/resources/com/graphhopper/custom_models/tgv_all.json deleted file mode 100644 index 71789ff..0000000 --- a/src/main/resources/com/graphhopper/custom_models/tgv_all.json +++ /dev/null @@ -1,24 +0,0 @@ -// to use this custom model you need to set the following option in the config.yml -// profiles: -// - name: rail -// turn_costs: -// vehicle_types: [] -// custom_model_files: [rail.json, tgv_all.json] - -// This model represents a TGV train supporting power systems 25kV AC, 15kV AC, 3kV DC, 1.5kV DC. -// maximum speed: 310 km/h -// This model does not use yard and spur tracks. - -{ - "distance_influence": 0, - "speed": [ - { "if": "railway_service == YARD || railway_service == SPUR", "multiply_by": "0.0" }, - { "else_if": "!(electrified == CONTACT_LINE || electrified == UNSET)", "multiply_by": "0.0" }, - { "else_if": "voltage >= 14000.0 && voltage <= 16000.0 && frequency >= 15.0 && frequency <= 17.5", "limit_to": "310" }, - { "else_if": "voltage >= 24000.0 && voltage <= 26000.0 && frequency >= 47.5 && frequency <= 52.5", "limit_to": "310" }, - { "else_if": "voltage >= 1400.0 && voltage <= 1600.0 && frequency == 0.0", "limit_to": "310" }, - { "else_if": "voltage >= 2900.0 && voltage <= 3100.0 && frequency == 0.0", "limit_to": "310" }, - { "else_if": "voltage == 0.0 && frequency == 0.0", "limit_to": "310" }, - { "else": "", "multiply_by": "0.0" } - ] -} diff --git a/src/main/resources/com/graphhopper/custom_models/tramtrain.json b/src/main/resources/com/graphhopper/custom_models/tramtrain.json deleted file mode 100644 index 6866500..0000000 --- a/src/main/resources/com/graphhopper/custom_models/tramtrain.json +++ /dev/null @@ -1,18 +0,0 @@ -// to use this custom model you need to set the following option in the config.yml -// profiles: -// - name: rail -// turn_costs: -// vehicle_types: [] -// custom_model_files: [rail.json] - -{ - "distance_influence": 0, - "priority": [ - { "if": "!rail_access", "multiply_by": "0" }, - { "else_if": "railway_class == RAIL || railway_class == TRAM || railway_class == LIGHT_RAIL", "multiply_by": "1" }, - { "else": "", "multiply_by": "0" } - ], - "speed": [ - { "if": "true", "limit_to": "rail_average_speed" } - ] -}