Fix: add safety check to not overuse the OSM-api
This commit is contained in:
parent
fd9c48b5b5
commit
4602df3046
1 changed files with 6 additions and 1 deletions
|
@ -72,6 +72,11 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
return
|
||||
}
|
||||
|
||||
if (neededTiles.total > 100) {
|
||||
console.error("Too much tiles to download!")
|
||||
return
|
||||
}
|
||||
|
||||
this.isRunning.setData(true)
|
||||
try {
|
||||
const tileNumbers = Tiles.MapRange(neededTiles, (x, y) => {
|
||||
|
@ -133,7 +138,6 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
}
|
||||
|
||||
private async LoadTile(z: number, x: number, y: number): Promise<void> {
|
||||
console.log("OsmFeatureSource: loading ", z, x, y, "from", this._backend)
|
||||
if (z >= 22) {
|
||||
throw "This is an absurd high zoom level"
|
||||
}
|
||||
|
@ -145,6 +149,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
if (this._downloadedTiles.has(index)) {
|
||||
return
|
||||
}
|
||||
console.log("OsmFeatureSource: loading ", z, x, y, "from", this._backend)
|
||||
this._downloadedTiles.add(index)
|
||||
|
||||
const bbox = BBox.fromTile(z, x, y)
|
||||
|
|
Loading…
Reference in a new issue