Fix bus parsing.

This commit is contained in:
Edward Betts 2026-02-18 09:46:01 +00:00
parent 3a786c4b04
commit 24f4c49429

View file

@ -141,8 +141,8 @@ def load_buses(
# Calculate CO2 emissions for bus (0.027 kg CO2e per passenger per km) # Calculate CO2 emissions for bus (0.027 kg CO2e per passenger per km)
item["co2_kg"] = item["distance"] * 0.1 item["co2_kg"] = item["distance"] * 0.1
# Include GeoJSON route if defined in stations data # Include GeoJSON route if defined in stations data
from_station = item.get("from_stop") from_station = item.get("from_station")
to_station = item.get("to_stop") to_station = item.get("to_station")
if from_station and to_station: if from_station and to_station:
# Support scalar or mapping routes: string or dict of station name -> geojson base name # Support scalar or mapping routes: string or dict of station name -> geojson base name
routes_val = from_station.get("routes", {}) routes_val = from_station.get("routes", {})