TerrainRegionExtractor

class TerrainRegionExtractor(store: TerrainTileStore, openArchive: (pmtilesUrl: String) -> TerrainRegionExtractor.TileArchive = ::remoteArchive)(source)

Extracts a region's offline terrain: a global low-res layer (always, up to MapterhornEndpoints.GLOBAL_MAX_ZOOM) plus, where bounds fits inside a single z6 tile, a regional high-res layer on top — ported from the sibling iOS app's two-tier TerrainStore download behavior. One tile per HTTP request, like the base offline layer's own extractor; see its README for why that bounds MAX_TILES well below iOS's own per-region cap.

This module owns nothing about how a terrain download relates to a base map region (shared storage budget, region lifecycle, "delete the terrain without touching the basemap") — that's the caller's integration concern, same separation as TerrainTileStore only knowing about the directory it's handed.

Constructors

Link copied to clipboard
constructor(store: TerrainTileStore, openArchive: (pmtilesUrl: String) -> TerrainRegionExtractor.TileArchive = ::remoteArchive)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

One open PMTiles archive — TerrainTileFetcher in production; a seam so tests can script sparse coverage.

Functions

Link copied to clipboard
fun download(bounds: GeoBounds, maxZoom: Int): Flow<TerrainDownloadState>