fix(offlinetiles): wrong fetching of local tiles
Some checks failed
TrafficCue CI / check (push) Failing after 57s
TrafficCue CI / build (push) Successful in 48s

This commit is contained in:
Cfp
2025-08-11 09:12:44 +02:00
parent 2fe1757866
commit 1730d1c111

View File

@ -30,8 +30,10 @@ export async function downloadPMTiles(url: string, name: string): Promise<void>
const path = await join(appDataDirPath, filename); const path = await join(appDataDirPath, filename);
let totalProgress = 0;
await download(url, path, ({ progress, total }) => { await download(url, path, ({ progress, total }) => {
console.log(`Download progress: ${Math.round((progress / total) * 100)}% (${progress}\tof ${total} bytes)`); totalProgress += progress;
console.log(`Download progress: ${Math.round((totalProgress / total) * 100)}% (${totalProgress}\tof ${total} bytes)`);
}); });
console.log(`Download completed: ${path}`); console.log(`Download completed: ${path}`);
@ -123,8 +125,7 @@ interface RequestParameters {
export class Protocol { export class Protocol {
/** @hidden */ /** @hidden */
tiles: Map<string, PMTiles>; tiles: Map<string, PMTiles>;
metadata: boolean; metadata: boolean; errorOnMissingTile: boolean;
errorOnMissingTile: boolean;
/** /**
* Initialize the MapLibre PMTiles protocol. * Initialize the MapLibre PMTiles protocol.
@ -203,7 +204,7 @@ export class Protocol {
let instance = this.tiles.get(pmtilesUrl); let instance = this.tiles.get(pmtilesUrl);
if (!instance) { if (!instance) {
instance = new PMTiles(pmtilesUrl); instance = new PMTiles(new FSSource(pmtilesUrl));
this.tiles.set(pmtilesUrl, instance); this.tiles.set(pmtilesUrl, instance);
} }
const z = result[2]; const z = result[2];