parent
f8658a7850
commit
e6cffdd3d5
|
@ -104,38 +104,33 @@ def collect_trip_coordinates(trip: Trip) -> list[StrDict]:
|
|||
continue
|
||||
stations[s["uic"]] = s
|
||||
|
||||
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
|
||||
]
|
||||
coords = []
|
||||
|
||||
station_coordinates = [
|
||||
{
|
||||
"name": s["name"],
|
||||
"type": "station",
|
||||
"latitude": s["latitude"],
|
||||
"longitude": s["longitude"],
|
||||
}
|
||||
for s in stations.values()
|
||||
]
|
||||
src = [("accommodation", trip.accommodation), ("conference", trip.conferences)]
|
||||
for coord_type, item_list in src:
|
||||
coords += [
|
||||
{
|
||||
"name": item["name"],
|
||||
"type": coord_type,
|
||||
"latitude": item["latitude"],
|
||||
"longitude": item["longitude"],
|
||||
}
|
||||
for item in item_list
|
||||
if "latitude" in item and "longitude" in item
|
||||
]
|
||||
|
||||
airport_coordinates = [
|
||||
{
|
||||
"name": s["name"],
|
||||
"type": "airport",
|
||||
"latitude": s["latitude"],
|
||||
"longitude": s["longitude"],
|
||||
}
|
||||
for s in airports.values()
|
||||
]
|
||||
for coord_type, coord_dict in ("station", stations), ("airport", airports):
|
||||
coords += [
|
||||
{
|
||||
"name": s["name"],
|
||||
"type": coord_type,
|
||||
"latitude": s["latitude"],
|
||||
"longitude": s["longitude"],
|
||||
}
|
||||
for s in coord_dict.values()
|
||||
]
|
||||
|
||||
return accommodation_coordinates + station_coordinates + airport_coordinates
|
||||
return coords
|
||||
|
||||
|
||||
def latlon_tuple(stop: StrDict) -> tuple[float, float]:
|
||||
|
|
|
@ -13,6 +13,7 @@ var icons = {
|
|||
"station": emoji_icon("🚉"),
|
||||
"airport": emoji_icon("✈️"),
|
||||
"accommodation": emoji_icon("🏨"),
|
||||
"conference": emoji_icon("🎤"),
|
||||
}
|
||||
|
||||
function build_map(map_id, coordinates, routes) {
|
||||
|
|
Loading…
Reference in a new issue