@tak-ps/mbtiles-offline
    Preparing search index...

    @tak-ps/mbtiles-offline

    @tak-ps/mbtiles-offline

    Download Web maps into an offline MBTiles database.

    import { MBTilesOffline } from '@tak-ps/mbtiles-offline';

    const download = new MBTilesOffline({
    name: 'My Map',
    description: 'Offline satellite imagery',
    version: '1.0.0',
    bounds: [-108.39, 38.60, -108.30, 38.65],
    minzoom: 0,
    maxzoom: 14,
    url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
    output: './satellite.mbtiles',
    concurrency: 50
    });

    download.on('total', (total) => {
    console.log(`Downloading ${total} tiles...`);
    });

    download.on('progress', (current) => {
    console.log(`Progress: ${current}`);
    });

    download.on('error', (err) => {
    console.error(err);
    });

    await download.start();

    By default tiles that only partially overlap bounds are clipped: the portion of the image outside the bounds is made transparent and the tile is re-encoded as PNG. Pass clip: false (or --no-clip on the CLI) to store tiles exactly as served.

    The MBTilesOffline constructor accepts the following options:

    Option Type Description
    bounds [number, number, number, number] Required GeoJSON BBox [minX, minY, maxX, maxY]
    minzoom number Required Minimum Zoom Level
    maxzoom number Required Maximum Zoom Level
    url string Required Tile URL Template. Must include {z}, {x}, {y}
    output string Required Path to write the MBTiles database
    name string Name of the tileset (metadata)
    description string Description of the tileset (metadata)
    version string Version of the tileset (metadata)
    concurrency number Number of concurrent requests (Default: 10)
    clip boolean Make pixels outside of bounds transparent so edge tiles at every zoom only show the requested area (Default: true)