forked from MapComplete/MapComplete
		
	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 |             return | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         if (neededTiles.total > 100) { | ||||||
|  |             console.error("Too much tiles to download!") | ||||||
|  |             return | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         this.isRunning.setData(true) |         this.isRunning.setData(true) | ||||||
|         try { |         try { | ||||||
|             const tileNumbers = Tiles.MapRange(neededTiles, (x, y) => { |             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> { |     private async LoadTile(z: number, x: number, y: number): Promise<void> { | ||||||
|         console.log("OsmFeatureSource: loading ", z, x, y, "from", this._backend) |  | ||||||
|         if (z >= 22) { |         if (z >= 22) { | ||||||
|             throw "This is an absurd high zoom level" |             throw "This is an absurd high zoom level" | ||||||
|         } |         } | ||||||
|  | @ -145,6 +149,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger { | ||||||
|         if (this._downloadedTiles.has(index)) { |         if (this._downloadedTiles.has(index)) { | ||||||
|             return |             return | ||||||
|         } |         } | ||||||
|  |         console.log("OsmFeatureSource: loading ", z, x, y, "from", this._backend) | ||||||
|         this._downloadedTiles.add(index) |         this._downloadedTiles.add(index) | ||||||
| 
 | 
 | ||||||
|         const bbox = BBox.fromTile(z, x, y) |         const bbox = BBox.fromTile(z, x, y) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue