# V3-11 — Offline tile pre-download **Phase** Ride management · **Depends on** V3-04 · **Size** M · **Status** Not started ## Goal Have map tiles available where there is no signal. ## Context `flutter_map` caches what it renders, so a re-viewed ride works. A **mountain ride with no signal shows blank tiles** — precisely where a map is most wanted. ## Design **Respect OSM's tile usage policy. Bulk prefetching their public servers is prohibited** and would get the app blocked. This constraint decides the design: - Pre-download only a **user-chosen area**, at a **limited zoom range**, with a visible tile count and size estimate before starting - Rate-limited, sequential, cancellable - If this becomes a headline feature, move to a paid tile provider or self-hosted tiles. Do not scale it on OSM's donated infrastructure. Natural pairing with V3-07: pre-download the corridor along a planned route rather than a rectangle — far fewer tiles for the same usefulness. ## Implementation 1. Persistent tile cache with a size cap and eviction (`flutter_map_cache` or similar) 2. Area selection on the map, plus a "download along this route" option 3. Tile count and MB estimate **before** any request 4. Sequential fetch with a delay, a progress indicator and cancellation 5. Settings: cache size, and a way to clear it ## Acceptance criteria - [ ] A downloaded area renders with the network off - [ ] Count and size shown before download starts - [ ] Cancellable mid-download, keeping what has already arrived - [ ] A hard cap on tiles per request — no unbounded area selection - [ ] Cache size visible and clearable ## Tests - Tile-count maths for a bounding box across zoom levels - Cache eviction at the cap - Cancellation leaves a consistent cache - **Manual:** aeroplane mode over a downloaded area ## Risks - **Abusing OSM's servers.** Cap, rate-limit, and be conservative. A blocked user agent would break the map for everyone. - Storage growth. Tiles add up fast; the cap is not optional. ## Out of scope Vector tiles or a full offline basemap.