Skip to content

[weather-voodoo] Map overlay: cycling trails + roads color-coded by hourly score #34

Description

@radumarias

Original idea (RO)

auzi feature

  • deschizi app și pe harta vezi toate traseele de bicicletă și cu score color pe ore din zi pe care e mai ok să mergi
  • la fel pe roads cum mergi tu cu cursiera

Summary (EN)

Add a map overlay mode where, instead of picking a from→to and getting a single forecast, you see all rideable ways in view rendered as polylines on the map, colored by the trip-score for the currently selected hour. Slide the hour selector and watch the network re-color — a glance tells you "where should I ride right now, or at 4pm?".

Two layers, toggleable:

  • 🥾 Off-road / MTB — OSM highway=path|track|bridleway|cycleway and ways with bicycle=designated
  • 🚴 Road cycling (cursieră) — OSM highway=cycleway|tertiary|secondary with bicycle=yes, plus route=bicycle relations (named cycling routes / EuroVelo / NCN)

Color band reuses the existing scoreToCss() 0–100 ramp from trip-score.ts. A way's score for a given hour is the same hour-score the table already computes (wind / gust / rain / temp / visibility blended for Land mode), evaluated at a representative point on the way (centroid or midpoint).

Why this is interesting

  • It inverts the current flow: instead of "I have a plan, what's the weather?" → "the weather is what it is, where should I go?"
  • Leverages OSM data we now already fetch for trail routing (OSM hiking & cycling trail routing for Land mode #33), so most of the backend plumbing exists.
  • Works great on mobile as a "decide where to ride in 30 seconds" tool.

Sketch of how it could work

  1. New /api/cycling-network?bbox=…&mode=offroad|road|both endpoint.
    • Overpass query for the requested categories within the map's bbox.
    • Returns a FeatureCollection<LineString> with each way's centroid lat/lon attached so the client can request a forecast for it.
  2. Client batches forecast fetches per cluster (don't hit Open-Meteo once per way — group by ~5 km grid cells and reuse).
  3. New CyclingOverlay.svelte layer on MapView that:
    • Renders all ways with paint: { line-color: scoreToColor(hourScores[wayId][hour]) }
    • Listens to an hour slider in the header.
    • Updates colors reactively as the slider changes.
  4. New top-level tab or mode toggle: 🚴 Explore (alongside Route / Fixed / Waypoints).
  5. Tap a way → drop a route through it and switch to Route view with that way's endpoints prefilled.

Open questions

  • Density / performance — a city bbox can be tens of thousands of cycleways. Need server-side simplification (drop tiny segments, snap to grid) and probably zoom-level filtering (only show named routes when zoomed out).
  • Forecast granularity — Open-Meteo is per-point. For a 5 × 5 km grid we'd still need a fan-out. Maybe limit overlay to the visible bbox and cap at N ways.
  • Network-wide score caching — the score is hour-dependent, so the cache key needs hour in it. A 24h × N-way matrix per bbox is OK if N is bounded.
  • Cycling-specific scoring — should we add a third mode (Cycling) on top of Sea / Land, or just reuse Land? Headwind / road-surface conditions matter more for road cycling than for hiking.

Related

https://claude.ai/code/session_01B9DMrLPT7hYfdCTsJgFF9q

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions