forked from MapComplete/MapComplete
		
	Various fixes
This commit is contained in:
		
							parent
							
								
									18044ff22b
								
							
						
					
					
						commit
						07fd8f404a
					
				
					 14 changed files with 154 additions and 60 deletions
				
			
		|  | @ -10,6 +10,10 @@ export class BBox { | |||
|     readonly minLat: number; | ||||
|     readonly minLon: number; | ||||
| 
 | ||||
|     /*** | ||||
|      * Coordinates should be [[lon, lat],[lon, lat]] | ||||
|      * @param coordinates | ||||
|      */ | ||||
|     constructor(coordinates) { | ||||
|         this.maxLat = -90; | ||||
|         this.maxLon = -180; | ||||
|  | @ -44,6 +48,21 @@ export class BBox { | |||
|         } | ||||
|         return feature.bbox; | ||||
|     } | ||||
|      | ||||
|     static bboxAroundAll(bboxes: BBox[]): BBox{ | ||||
|         let maxLat: number = -90; | ||||
|         let maxLon: number= -180; | ||||
|         let minLat: number= 80; | ||||
|         let minLon: number= 180; | ||||
| 
 | ||||
|         for (const bbox of bboxes) { | ||||
|             maxLat = Math.max(maxLat, bbox.maxLat) | ||||
|             maxLon = Math.max(maxLon, bbox.maxLon) | ||||
|             minLat = Math.min(minLat, bbox.minLat) | ||||
|             minLon = Math.min(minLon, bbox.minLon) | ||||
|         } | ||||
|         return new BBox([[maxLon, maxLat],[minLon,minLat]]) | ||||
|     } | ||||
| 
 | ||||
|     static fromTile(z: number, x: number, y: number): BBox { | ||||
|         return new BBox(Tiles.tile_bounds_lon_lat(z, x, y)) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue