forked from MapComplete/MapComplete
		
	Reformat all files with prettier
This commit is contained in:
		
							parent
							
								
									e22d189376
								
							
						
					
					
						commit
						b541d3eab4
					
				
					 382 changed files with 50893 additions and 35566 deletions
				
			
		|  | @ -1,20 +1,17 @@ | |||
| /** | ||||
|  * Generates an overview for which tiles exist and which don't | ||||
|  */ | ||||
| import ScriptUtils from "./ScriptUtils"; | ||||
| import {writeFileSync} from "fs"; | ||||
| import ScriptUtils from "./ScriptUtils" | ||||
| import { writeFileSync } from "fs" | ||||
| 
 | ||||
| function main(args: string[]) { | ||||
| 
 | ||||
|     const directory = args[0] | ||||
|     let zoomLevel = args[1] | ||||
|     const files = ScriptUtils.readDirRecSync(directory, 1) | ||||
|         .filter(f => f.endsWith(".geojson")) | ||||
|     const files = ScriptUtils.readDirRecSync(directory, 1).filter((f) => f.endsWith(".geojson")) | ||||
| 
 | ||||
|     const indices /* Map<string, number[]>*/ = {} | ||||
|     for (const path of files) { | ||||
| 
 | ||||
|         const match = path.match(".*_\([0-9]*\)_\([0-9]*\)_\([0-9]*\).geojson") | ||||
|         const match = path.match(".*_([0-9]*)_([0-9]*)_([0-9]*).geojson") | ||||
|         if (match === null) { | ||||
|             continue | ||||
|         } | ||||
|  | @ -32,8 +29,8 @@ function main(args: string[]) { | |||
|         } | ||||
|         indices[x].push(Number(y)) | ||||
|     } | ||||
|     indices["zoom"] = zoomLevel; | ||||
|     const match = files[0].match("\(.*\)_\([0-9]*\)_\([0-9]*\)_\([0-9]*\).geojson") | ||||
|     indices["zoom"] = zoomLevel | ||||
|     const match = files[0].match("(.*)_([0-9]*)_([0-9]*)_([0-9]*).geojson") | ||||
|     const path = match[1] + "_" + zoomLevel + "_overview.json" | ||||
|     writeFileSync(path, JSON.stringify(indices)) | ||||
|     console.log("Written overview for", files.length, " tiles at", path) | ||||
|  | @ -41,10 +38,10 @@ function main(args: string[]) { | |||
| 
 | ||||
| let args = [...process.argv] | ||||
| args.splice(0, 2) | ||||
| args.forEach(file => { | ||||
| args.forEach((file) => { | ||||
|     try { | ||||
|         main(args) | ||||
|     } catch (e) { | ||||
|         console.error("Could not handle file ", file, " due to ", e) | ||||
|     } | ||||
| }) | ||||
| }) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue