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 a regional high-res layer from every z6 regional archive the bounds touch, each clipped to its own z6 tile. A z6 tile with no published archive contributes nothing, and the renderer falls back to the global layer there. 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. openArchive returns null for an archive the host doesn't have.

Functions

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