Collect One: Native offline imagery download on Android and iOS

Aperta
#2,648 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, ios, kotlin, swift
Ambito
mobile, mobile-dev

Direzione di ricerca

Start by reading the platform-neutral OfflineRegionStore API in shared/map, then inspect the Android entry points in shared/map/src/androidMain and the iOS bridge pattern in shared/map/src/iosMain and iosApp. Verify on a device or simulator using the stated Mapbox token and user data service URL; done means the acceptance criteria for downloads, offline rendering, cancellation, resume, and removal pass on both platforms.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

collect-one type: fr

Collect One mobile is getting a Save for offline flow:

  • Collectors pan and zoom to frame an area of up to 50 km² and choose Satellite, Terrain, or both.
  • They see the estimated size and the free space on the device, then save the imagery with a progress bar.
  • Saved areas are named by reverse geocoding and listed under Offline maps, with each imagery type shown as a separate layer.
  • The layers sheet gets two switches: Downloaded satellite and Downloaded terrain.

The shared UX, state and persistence are on branch feat/offline-area-download. Downloads go through a data-layer port, OfflineRegionClient (shared/app/data/.../client/offline/). Each host app supplies its implementation through platformModule(offlineRegionClient = …):

  • The browser build uses SimulatedOfflineRegionClient, with placeholder area names and a "Simulated download" notice, because Mapbox GL JS has no offline API.
  • Android and iOS default to UnavailableOfflineRegionClient, which hides the "Save an area" entry points.

This issue tracks real NATIVE clients for Android and iOS.

Scope

Android (shared/map/src/androidMain + androidApp)
  • Implement a NATIVE OfflineRegionClient with the Mapbox Maps SDK v11 TileStore and OfflineManager. The SDK lives in shared/map, so put the implementation there and adapt it to the port in androidApp (MobileSyncRuntime → platformModule(offlineRegionClient = …)):
    • Create one tile region per saved layer, using one style per layer:
      • Satellite: mapbox://styles/mapbox/satellite-streets-v12
      • Terrain: mapbox://styles/mapbox/outdoors-v12
    • Download each region for zoom 6–16 (always full zoom 16 detail), with pixelRatio set to the display density.
    • Store the area metadata on each region: area id, name, bounds, layer type, creation time and schema version.
    • Load a layer's style pack the first time that layer type is saved. Remove the style pack once no region uses it.
    • Estimate each layer with TileStore.estimateTileRegion (storage size, transfer size, error margin).
    • Report progress from TileRegionLoadProgress. Cancel through Cancelable, and resume by loading the same region id again.
    • List regions, including partial ones, so layers can be grouped into areas at launch.
    • Set MapboxOptions.accessToken from the app's configured token if no map has set it yet.
    • Map TileRegionError types to user-facing failures: tile-pack limit reached, disk full, access denied, and network unavailable.
  • First run the Android app on an emulator or device with a Mapbox token and a user data service URL. Then run the spike:
    • Confirm estimateTileRegion exists in 11.31.1.
    • Confirm the bounded mapbox://mapbox.satellite raster and the contour line overlay render from TileStore while offline.
    • Measure tile packs and bytes for a 50 km² save, then calibrate the simulated estimates and the area limit.
  • Verify against the acceptance criteria below.
iOS (shared/map/src/iosMain and iosApp)
  • Add a callback-based MapboxIosOfflineBridge interface that passes JSON in and out, following the existing MapboxIosView pattern.
  • Implement it in Swift with TileStore.default and OfflineManager, register it on GroundMapIos in iOSApp.init, and pass the adapter to platformModule from GroundMobileSyncIos.
  • Verify on a device or simulator once the iOS build is running again.

Acceptance criteria

  • Saving an area downloads the selected layers for zoom 6–16. The progress bar reaches 100%, and the area appears in Offline maps with each layer's size on disk.
  • With airplane mode on, and after force-stopping and reopening the app, each saved layer's basemap renders inside the area.
  • Downloaded satellite outlines satellite areas. On the Terrain basemap, it also shows the saved satellite imagery inside them.
  • Downloaded terrain outlines terrain areas. On the Satellite basemap, it also draws contour lines from the saved terrain data inside them.
  • Cancel removes partial data. Killing the app mid-save leaves the layer Paused, and Resume completes it.
  • Removing a layer frees its unshared data. Removing an area's last layer removes the area.
  • Area names come from Mapbox Geocoding v6 reverse lookups with permanent=true. If the lookup fails, a coordinate label is used instead.
  • Saving is blocked when the area exceeds 50 km² (about 7 × 7 km), or when the estimate plus a 500 MB reserve exceeds free space. Reaching Mapbox's tile-pack limit shows a clear message.

Constraints

  • Mapbox offline tile packs stop at zoom 16; imagery beyond zoom 16 is upscaled.
  • Mapbox allows 750 unique tile packs per device by default, shared across all saved layers.
  • Saved tiles render only for the exact style URIs and source URLs that were downloaded, so the overlays must reuse the styles' source URLs.
  • Satellite and Terrain share Mapbox's street tiles, so per-layer sizes can overlap.

Free-space measurement (DeviceStorageClient: StatFs on Android, NSFileManager on iOS) and the saved-areas table (SQLDelight) already exist on the branch.

Lingua principale
TypeScript
Stelle
254
Fork
114
Merge medio
2g 3h
PR unite (30g)
20

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/ground-platform

Tutte le issue di google/ground-platform

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.