download

fun download(bounds: GeoBounds, maxZoom: Int): Flow<TerrainDownloadState>(source)

Replaces whatever region was downloaded before with a fresh one covering bounds up to maxZoom.

Runs on ioDispatcherTerrainRegionExtractor does blocking range-request I/O per tile (see TerrainTileFetcher's own doc comment), and this flow's collector must never be left running on the caller's own dispatcher for that reason. The manifest is written only after the extractor reports TerrainDownloadState.Complete, so a process death mid-download leaves tiles with no manifest — loadIfNeeded treats that combination as orphaned and clears it, rather than resurrecting a manifest-less region.