createElevationSourceFactory

open suspend override fun createElevationSourceFactory(contentKey: String, tileMatrixSet: TileMatrixSet, networkSource: TileSource?, outputFormat: String, isFloat: Boolean = false, cachePolicy: CachePolicy = CachePolicy.UNBOUNDED, displayName: String? = null): ElevationSourceFactory

Build an ElevationSourceFactory backed by this content manager's elevation cache. The factory owns the source-format → storage-format transcoding for every tile — callers just supply the network source (or null for offline replay) and the desired storage layout via isFloat.

This is the only public way to access elevation cache content. The cache holds encoded tile blobs (PNG-Int16 with per-tile (scale, offset) or TIFF-Float32) — not raw network bytes — so a generic byte-level openCoverageStore analog of the other openXxxStore methods would be a footgun. Pair it with CachedTileSource and the decoder gets raw-bytes-through-BIL16-decoder garbage. This factory hides that asymmetry behind a single correct entry point.

Transcoding semantics (platform-dependent):

  • GeoPackage backend (JVM/Android): stored as TIFF-Float32 when isFloat is true, PNG-Int16 with per-tile (scale, offset) packing when isFloat is false. The Float→Int packing path never rounds through a WorldWind ShortArray intermediate — the in-memory FloatBuffer is mapped directly to 16-bit codes via per-tile linear scaling, preserving the source's precision up to the Int16 quantization step. Ancillary metadata is written to gpkg_2d_gridded_tile_ancillary (per-tile) and gpkg_2d_gridded_coverage_ancillary (per-coverage).

  • IndexedDB backend (JS): same encode/decode pipeline, ancillary metadata stored in a sidecar coverage_ancillary object store keyed by [contentKey, z, x, y].

  • Filesystem backend (iOS): same encode/decode pipeline, ancillary metadata stored in a .ancillary sidecar file next to each tile blob.

isFloat is the storage layout. On first creation it's the chosen layout — written to the platform's dataType attribute and locked in. On reopen the stored value is canonical; a caller value that disagrees is logged (WARN) and the stored value still wins. Query findEntry's metadata (cast to CacheEntry.isFloat) for the stored answer.

networkSource is the upstream tile producer (typically a WMS / WCS / WMTS source adapter). Pass null for offline replay — cache misses then return null instead of triggering a network fetch.

outputFormat is the upstream's wire format (application/bil16, image/tiff, etc.) — used to decode bytes returned by networkSource. Independent of the storage format chosen via isFloat.