Skip to content

spatial-monorepo


spatial-monorepo / pmtiles/src / prefetchTiles

Function: prefetchTiles()

prefetchTiles(map, opts): () => void

Defined in: packages/pmtiles/src/prefetchTiles.ts:277

Prefetches PMTiles tile data for the given bounding box and zoom range. Runs after the current frame via requestAnimationFrame so it does not affect time-to-first-tile.

Resolves tiles through the PMTiles archive's own directory (real HTTP Range requests against the archive URL), sharing the registered Protocol's PMTiles instance where possible so warmed tiles land in the same cache the renderer reads from.

opts.maxBytes is accounted conservatively, not exactly, for archives that declare gzip/brotli tile compression — see PrefetchOptions.maxBytes.

Parameters

map

getStyle

opts

PrefetchOptions

Returns

Cleanup function that cancels in-flight requests.

() => void

Released under commercial licensing.