import { T as TileInfo$1 } from './types-yLQy3AKR.js'; import * as stream from 'stream'; import { BBox } from './utils/geo.js'; import { FetchQueue } from './utils/fetch.js'; import '@maplibre/maplibre-gl-style-spec'; import 'geojson'; import 'type-fest'; import 'readable-stream'; import 'events'; import './utils/streams.js'; /** @typedef {Omit} TileInfo */ /** * @typedef {object} TileDownloadStats * @property {number} total * @property {number} downloaded * @property {number} skipped * @property {number} totalBytes */ /** * Download tiles from a list of tile URLs within a bounding box and zoom range. * Returns an async generator of tile data as readable streams and tile info objects. * * @param {object} opts * @param {string[]} opts.tileUrls Array of tile URL templates. Use `{x}`, `{y}`, `{z}` placeholders, and optional `{scheme}` placeholder which can be `xyz` or `tms`. * @param {import('./utils/geo.js').BBox} opts.bounds Bounding box of the area to download * @param {number} opts.maxzoom Maximum zoom level to download * @param {(progress: TileDownloadStats) => void} [opts.onprogress] Callback to report download progress * @param {boolean} [opts.trackErrors=false] Include errors in the returned array of skipped tiles - this has memory overhead so should only be used for debugging. * @param {import('./utils/geo.js').BBox} [opts.sourceBounds=MAX_BOUNDS] Bounding box of source data. * @param {boolean} [opts.boundsBuffer=false] Buffer the bounds by one tile at each zoom level to ensure no tiles are missed at the edges. With this set to false, in most instances the map will appear incomplete when viewed because the downloaded tiles at lower zoom levels will not cover the map view area. * @param {number} [opts.minzoom=0] Minimum zoom level to download (for most cases this should be left as `0` - the size overhead is minimal, because each zoom level has 4x as many tiles) * @param {number} [opts.concurrency=8] Number of concurrent downloads (ignored if `fetchQueue` is provided) * @param {FetchQueue} [opts.fetchQueue=new FetchQueue(concurrency)] Optional fetch queue to use for downloading tiles * @param {'xyz' | 'tms'} [opts.scheme='xyz'] Tile scheme to use for tile URLs * @returns {AsyncGenerator<[import('stream').Readable, TileInfo]> & { readonly skipped: Array, readonly stats: TileDownloadStats }} */ declare function downloadTiles({ tileUrls, bounds, maxzoom, onprogress, trackErrors, sourceBounds, boundsBuffer, minzoom, concurrency, fetchQueue, scheme, }: { tileUrls: string[]; bounds: BBox; maxzoom: number; onprogress?: ((progress: TileDownloadStats) => void) | undefined; trackErrors?: boolean | undefined; sourceBounds?: BBox | undefined; boundsBuffer?: boolean | undefined; minzoom?: number | undefined; concurrency?: number | undefined; fetchQueue?: FetchQueue | undefined; scheme?: "xyz" | "tms" | undefined; }): AsyncGenerator<[stream.Readable, TileInfo]> & { readonly skipped: Array; readonly stats: TileDownloadStats; }; /** * * @param {object} opts * @param {import('./utils/geo.js').BBox} [opts.bounds] * @param {import('./utils/geo.js').BBox} [opts.sourceBounds] * @param {boolean} [opts.boundsBuffer] * @param {number} [opts.minzoom] * @param {number} opts.maxzoom */ declare function tileIterator({ bounds, minzoom, maxzoom, sourceBounds, boundsBuffer, }: { bounds?: BBox | undefined; sourceBounds?: BBox | undefined; boundsBuffer?: boolean | undefined; minzoom?: number | undefined; maxzoom: number; }): Generator<{ x: number; y: number; z: number; }, void, unknown>; type TileInfo = Omit; type TileDownloadStats = { total: number; downloaded: number; skipped: number; totalBytes: number; }; export { type TileDownloadStats, type TileInfo, downloadTiles, tileIterator };