Show home marker for car journeys

This commit is contained in:
Edward Betts 2026-07-09 10:10:17 +01:00
parent 086bc630c9
commit 1e9169b740
3 changed files with 56 additions and 5 deletions

View file

@ -384,6 +384,19 @@ def car_endpoint_marker_type(item: StrDict, direction: str, label: str) -> str:
return marker_type if isinstance(marker_type, str) else car_endpoint_type(label)
def show_car_endpoint_marker(item: StrDict, direction: str, label: str) -> bool:
"""Return whether to show a car endpoint marker on the map."""
direction_marker = item.get(direction + "_show_marker")
if isinstance(direction_marker, bool):
return direction_marker
show_markers = item.get("show_markers")
if isinstance(show_markers, bool):
return show_markers
return car_endpoint_type(label) == "home"
def load_cars(data_dir: str) -> list[StrDict]:
"""Load car journeys."""
filename = os.path.join(data_dir, "car_journeys.yaml")
@ -416,7 +429,7 @@ def load_cars(data_dir: str) -> list[StrDict]:
("from", "from_location", from_label, endpoints[0]),
("to", "to_location", to_label, endpoints[1]),
):
if not label:
if not label or not show_car_endpoint_marker(item, direction, label):
continue
item[field] = {
"name": label,