From 5251a011602ad664c981a79a44ca75d8a6c2e6bc Mon Sep 17 00:00:00 2001 From: billatq <8d8k@anmt.net> Date: Wed, 29 Apr 2026 09:57:50 -0400 Subject: [PATCH] Fix road graph build crash when route tag is absent --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 2f9d7a2..628f8e2 100644 --- a/main.py +++ b/main.py @@ -152,6 +152,7 @@ def _in_bbox(self, lat: float, lon: float) -> bool: def way(self, w): tags = {t.k: t.v for t in w.tags} + route_tag = tags.get("route") if self.mode == "road": hw = tags.get("highway") @@ -161,7 +162,6 @@ def way(self, w): oneway = oneway_tag in {"yes", "true", "1"} or self._oneway_default.get(hw, False) or tags.get("junction") == "roundabout" else: # rail rw = tags.get("railway") - route_tag = tags.get("route") is_rail = rw is not None and rw in self.RAIL_TYPES is_ferry = route_tag in self.FERRY_ROUTE_TAG @@ -1532,4 +1532,4 @@ def build_trip_shapes_for_viewer(gtfs_dir: str, stops: pd.DataFrame, stop_times: if __name__ == "__main__": - main() \ No newline at end of file + main()