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