Show venue pins on the map

Closes: #108
This commit is contained in:
Edward Betts 2024-01-14 21:43:10 +00:00
parent f8658a7850
commit e6cffdd3d5
2 changed files with 25 additions and 29 deletions

View file

@ -104,38 +104,33 @@ def collect_trip_coordinates(trip: Trip) -> list[StrDict]:
continue
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"],
"type": "accommodation",
"latitude": accommodation["latitude"],
"longitude": accommodation["longitude"],
"name": item["name"],
"type": coord_type,
"latitude": item["latitude"],
"longitude": item["longitude"],
}
for accommodation in trip.accommodation
if "latitude" in accommodation and "longitude" in accommodation
for item in item_list
if "latitude" in item and "longitude" in item
]
station_coordinates = [
for coord_type, coord_dict in ("station", stations), ("airport", airports):
coords += [
{
"name": s["name"],
"type": "station",
"type": coord_type,
"latitude": s["latitude"],
"longitude": s["longitude"],
}
for s in stations.values()
for s in coord_dict.values()
]
airport_coordinates = [
{
"name": s["name"],
"type": "airport",
"latitude": s["latitude"],
"longitude": s["longitude"],
}
for s in airports.values()
]
return accommodation_coordinates + station_coordinates + airport_coordinates
return coords
def latlon_tuple(stop: StrDict) -> tuple[float, float]:

View file

@ -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) {