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 = []
|
||||||
|
|
||||||
|
src = [("accommodation", trip.accommodation), ("conference", trip.conferences)]
|
||||||
|
for coord_type, item_list in src:
|
||||||
|
coords += [
|
||||||
{
|
{
|
||||||
"name": accommodation["name"],
|
"name": item["name"],
|
||||||
"type": "accommodation",
|
"type": coord_type,
|
||||||
"latitude": accommodation["latitude"],
|
"latitude": item["latitude"],
|
||||||
"longitude": accommodation["longitude"],
|
"longitude": item["longitude"],
|
||||||
}
|
}
|
||||||
for accommodation in trip.accommodation
|
for item in item_list
|
||||||
if "latitude" in accommodation and "longitude" in accommodation
|
if "latitude" in item and "longitude" in item
|
||||||
]
|
]
|
||||||
|
|
||||||
station_coordinates = [
|
for coord_type, coord_dict in ("station", stations), ("airport", airports):
|
||||||
|
coords += [
|
||||||
{
|
{
|
||||||
"name": s["name"],
|
"name": s["name"],
|
||||||
"type": "station",
|
"type": coord_type,
|
||||||
"latitude": s["latitude"],
|
"latitude": s["latitude"],
|
||||||
"longitude": s["longitude"],
|
"longitude": s["longitude"],
|
||||||
}
|
}
|
||||||
for s in stations.values()
|
for s in coord_dict.values()
|
||||||
]
|
]
|
||||||
|
|
||||||
airport_coordinates = [
|
return coords
|
||||||
{
|
|
||||||
"name": s["name"],
|
|
||||||
"type": "airport",
|
|
||||||
"latitude": s["latitude"],
|
|
||||||
"longitude": s["longitude"],
|
|
||||||
}
|
|
||||||
for s in airports.values()
|
|
||||||
]
|
|
||||||
|
|
||||||
return accommodation_coordinates + station_coordinates + airport_coordinates
|
|
||||||
|
|
||||||
|
|
||||||
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