fix(offlinetiles): wrong fetching of local tiles
This commit is contained in:
@ -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];
|
||||||
|
|||||||
Reference in New Issue
Block a user