Skip to content

Commit e1c2292

Browse files
[OpenLayers]: Bump to latest
1 parent fdf2c40 commit e1c2292

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"human-date": "1.4.0",
3232
"isomorphic-fetch": "3.0.0",
3333
"localforage": "1.10.0",
34-
"ol": "8.2.0",
34+
"ol": "9.1.0",
3535
"proj4": "2.9.2",
3636
"svelte-frappe-charts": "1.10.0",
3737
"uuid": "9.0.0"

src/utils/tileDownloader.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Extent, getTopLeft, getBottomRight, getTopRight } from 'ol/extent';
33
import { toLonLat } from 'ol/proj';
44
import { Coordinate } from 'ol/coordinate';
55
import { TileCoord } from 'ol/tilecoord';
6-
import * as localforage from 'localforage'
76
import { getCacheId, getTileCacher } from '../sources/cachingSource';
87
import { linzTopo } from '../layers/layerDefinitions';
98
const ESTIMATED_TILE_SIZE = 40 * 1024; // Estimate each tile at 40kb.
@@ -86,25 +85,19 @@ export class TileDownloader {
8685
while (!result.done) {
8786
const tile = result.value;
8887
const url = urlFunc([tile.z, tile.x, tile.y]);
89-
const cacheId = getCacheId(linzTopo, [tile.z, tile.x, tile.y]);
88+
getCacheId(linzTopo, [tile.z, tile.x, tile.y]);
9089
await cacher([tile.z, tile.x, tile.y], url);
91-
// Only download tiles we haven't seen.
92-
if (!await localforage.getItem(cacheId)) {
93-
const response = await fetch(url);
94-
const blob = await response.blob();
95-
await localforage.setItem(cacheId, blob);
96-
}
9790

9891
downloadedTiles += 1;
9992
onProgress(downloadedTiles / totalTiles);
10093
result = queue.next();
10194
}
10295
}
10396

104-
const workers = [];
97+
const workers: Promise<void>[] = [];
10598
for (let i = 0; i < this.numWorkers; ++i)
10699
workers.push(worker());
107100

108101
await Promise.all(workers);
109102
}
110-
}
103+
}

0 commit comments

Comments
 (0)