diff --git a/agenda/trip.py b/agenda/trip.py index ed9005a..f7b5626 100644 --- a/agenda/trip.py +++ b/agenda/trip.py @@ -104,7 +104,18 @@ def collect_trip_coordinates(trip: Trip) -> list[StrDict]: continue stations[s["uic"]] = s - return [ + accommodation_coordinates = [ + { + "name": accommodation["name"], + "type": "accommodation", + "latitude": accommodation["latitude"], + "longitude": accommodation["longitude"], + } + for accommodation in trip.accommodation + if "latitude" in accommodation and "longitude" in accommodation + ] + + station_coordinates = [ { "name": s["name"], "type": "station", @@ -112,7 +123,9 @@ def collect_trip_coordinates(trip: Trip) -> list[StrDict]: "longitude": s["longitude"], } for s in stations.values() - ] + [ + ] + + airport_coordinates = [ { "name": s["name"], "type": "airport", @@ -122,6 +135,8 @@ def collect_trip_coordinates(trip: Trip) -> list[StrDict]: for s in airports.values() ] + return accommodation_coordinates + station_coordinates + airport_coordinates + def latlon_tuple(stop: StrDict) -> tuple[float, float]: """Given a transport stop return the lat/lon as a tuple."""