forked from MapComplete/MapComplete
		
	Merge branch 'develop' into feature/studio
This commit is contained in:
		
						commit
						c229b92221
					
				
					 133 changed files with 1056 additions and 2081 deletions
				
			
		|  | @ -2,10 +2,9 @@ import { existsSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from | |||
| import ScriptUtils from "./ScriptUtils" | ||||
| import { Utils } from "../Utils" | ||||
| import Script from "./Script" | ||||
| import TiledFeatureSource from "../Logic/FeatureSource/TiledFeatureSource/TiledFeatureSource" | ||||
| import StaticFeatureSource from "../Logic/FeatureSource/Sources/StaticFeatureSource" | ||||
| import { GeoOperations } from "../Logic/GeoOperations" | ||||
| import { Feature, Polygon } from "geojson" | ||||
| import { Tiles } from "../Models/TileRange" | ||||
| 
 | ||||
| class StatsDownloader { | ||||
|     private readonly urlTemplate = | ||||
|  | @ -275,47 +274,29 @@ class GenerateSeries extends Script { | |||
|         const centerpoints = allFeatures.map((f) => GeoOperations.centerpoint(f)) | ||||
|         console.log("Found", centerpoints.length, " changesets in total") | ||||
|         const path = `${targetDir}/all_centerpoints.geojson` | ||||
|         /*fs.writeFileSync( | ||||
|             path, | ||||
|             JSON.stringify( | ||||
|                 { | ||||
|                     type: "FeatureCollection", | ||||
|                     features: centerpoints, | ||||
|                 }, | ||||
|                 null, | ||||
|                 "  " | ||||
| 
 | ||||
|         const perBbox = GeoOperations.spreadIntoBboxes(centerpoints, options.zoomlevel) | ||||
| 
 | ||||
|         for (const [tileNumber, features] of perBbox) { | ||||
|             const [z, x, y] = Tiles.tile_from_index(tileNumber) | ||||
|             const path = `${targetDir}/tile_${z}_${x}_${y}.geojson` | ||||
|             features.forEach((f) => { | ||||
|                 delete f.bbox | ||||
|             }) | ||||
|             writeFileSync( | ||||
|                 path, | ||||
|                 JSON.stringify( | ||||
|                     { | ||||
|                         type: "FeatureCollection", | ||||
|                         features: features, | ||||
|                     }, | ||||
|                     null, | ||||
|                     "  " | ||||
|                 ) | ||||
|             ) | ||||
|         )//*/
 | ||||
|         TiledFeatureSource.createHierarchy(StaticFeatureSource.fromGeojson(centerpoints), { | ||||
|             minZoomLevel: options.zoomlevel, | ||||
|             maxZoomLevel: options.zoomlevel, | ||||
|             maxFeatureCount: Number.MAX_VALUE, | ||||
|             registerTile: (tile) => { | ||||
|                 const path = `${targetDir}/tile_${tile.z}_${tile.x}_${tile.y}.geojson` | ||||
|                 const features = tile.features.data.map((ff) => ff.feature) | ||||
|                 features.forEach((f) => { | ||||
|                     delete f.bbox | ||||
|                 }) | ||||
|                 writeFileSync( | ||||
|                     path, | ||||
|                     JSON.stringify( | ||||
|                         { | ||||
|                             type: "FeatureCollection", | ||||
|                             features: features, | ||||
|                         }, | ||||
|                         null, | ||||
|                         "  " | ||||
|                     ) | ||||
|                 ) | ||||
|                 ScriptUtils.erasableLog( | ||||
|                     "Written ", | ||||
|                     path, | ||||
|                     "which has ", | ||||
|                     tile.features.data.length, | ||||
|                     "features" | ||||
|                 ) | ||||
|             }, | ||||
|         }) | ||||
| 
 | ||||
|             ScriptUtils.erasableLog("Written ", path, "which has ", features.length, "features") | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ async function main(includeTags = true) { | |||
|             continue | ||||
|         } | ||||
| 
 | ||||
|         const sources = TagUtils.Tag(layer.source.osmTags) | ||||
|         const sources = TagUtils.Tag(layer.source["osmTags"]) | ||||
|         const allKeys = sources.usedKeys() | ||||
|         for (const key of allKeys) { | ||||
|             if (!keysAndTags.has(key)) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue