From 4a7a5962de7f88ede2322ac5138d09d2d9662fce Mon Sep 17 00:00:00 2001 From: Paul Tran-Van Date: Wed, 13 Mar 2024 18:33:11 +0100 Subject: [PATCH] Add trolleybus support Trolleybus (https://en.wikipedia.org/wiki/Trolleybus) is a public transportation mode supported by OSM: https://wiki.openstreetmap.org/wiki/Public_transport --- emission/analysis/classification/inference/mode/rule_engine.py | 2 +- emission/core/wrapper/modeprediction.py | 1 + emission/net/ext_service/transit_matching/match_stops.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/emission/analysis/classification/inference/mode/rule_engine.py b/emission/analysis/classification/inference/mode/rule_engine.py index 837364a1d..95b825bd8 100644 --- a/emission/analysis/classification/inference/mode/rule_engine.py +++ b/emission/analysis/classification/inference/mode/rule_engine.py @@ -219,7 +219,7 @@ def collapse_modes(section_entry, modes): if len(unique_modes) == 1: return list(unique_modes)[0] - supported_modes = set(['BUS', 'TRAIN', 'LIGHT_RAIL', 'SUBWAY', 'TRAM']) + supported_modes = set(['BUS', 'TRAIN', 'LIGHT_RAIL', 'SUBWAY', 'TRAM', 'TROLLEYBUS']) if not unique_modes.issubset(supported_modes): logging.error("unique_modes = %s, but we support only %s" % diff --git a/emission/core/wrapper/modeprediction.py b/emission/core/wrapper/modeprediction.py index 853dcb82b..7b436b203 100644 --- a/emission/core/wrapper/modeprediction.py +++ b/emission/core/wrapper/modeprediction.py @@ -25,6 +25,7 @@ class PredictedModeTypes(enum.Enum): SUBWAY = 7 TRAM = 8 LIGHT_RAIL = 9 + TROLLEYBUS = 10 class Modeprediction(ecwb.WrapperBase): props = {"trip_id": ecwb.WrapperBase.Access.WORM, # the trip that this is part of diff --git a/emission/net/ext_service/transit_matching/match_stops.py b/emission/net/ext_service/transit_matching/match_stops.py index d08505e9e..bce697622 100644 --- a/emission/net/ext_service/transit_matching/match_stops.py +++ b/emission/net/ext_service/transit_matching/match_stops.py @@ -295,6 +295,8 @@ def extract_railway_modes(stop): p_modes.append("TRAM") if "light_rail" in stop: p_modes.append("LIGHT_RAIL") + if "trolleybus" in stop: + p_modes.append("TROLLEYBUS") logging.debug("After extracting data from tags, potential modes = %s" % [p for p in p_modes])