forked from MapComplete/MapComplete
		
	Dynamic JSON: only request existing tiles if a whitelist is given
This commit is contained in:
		
							parent
							
								
									adb36c2ffe
								
							
						
					
					
						commit
						69f21f29eb
					
				
					 6 changed files with 8 additions and 21 deletions
				
			
		|  | @ -48,8 +48,7 @@ export default class DynamicGeoJsonTileSource extends DynamicTileSource { | |||
|                 if(whitelist !== undefined){ | ||||
|                     const isWhiteListed = whitelist.get(zxy[1])?.has(zxy[2]) | ||||
|                     if(!isWhiteListed){ | ||||
|                         console.log("Not whitelisted:",zxy, isWhiteListed, whitelist) | ||||
|                     //    return undefined;
 | ||||
|                         return undefined; | ||||
|                     } | ||||
|                 } | ||||
|                  | ||||
|  |  | |||
|  | @ -159,10 +159,8 @@ export class TileHierarchyAggregator implements FeatureSource { | |||
|         const self = this | ||||
|         const empty = [] | ||||
|         return new StaticFeatureSource( | ||||
|             locationControl.map(loc => { | ||||
|                 const targetZoom = loc.zoom | ||||
|                  | ||||
|                 if(targetZoom > clusteringConfig.maxZoom){ | ||||
|             locationControl.map(loc => loc.zoom).map(targetZoom => { | ||||
|                 if(targetZoom-1 > clusteringConfig.maxZoom){ | ||||
|                     return empty | ||||
|                 } | ||||
|                  | ||||
|  |  | |||
|  | @ -32,7 +32,7 @@ | |||
|   "enablePdfDownload": true, | ||||
|   "enableDownload": true, | ||||
|   "hideFromOverview": true, | ||||
|     "#": "Disable clustering for this theme", | ||||
|   "#": "Disable clustering for this theme", | ||||
|   "clustering": { | ||||
|     "maxZoom": 0 | ||||
|   }, | ||||
|  | @ -71,7 +71,6 @@ | |||
|             ] | ||||
|           }, | ||||
|           "geoJson": "https://pietervdvn.github.io/natuurpunt_cache/natuurpunt_nature_reserve_points.geojson", | ||||
|           "geoJsonZoomLevel": 0, | ||||
|           "isOsmCache": "duplicate" | ||||
|         }, | ||||
|         "minzoom": 1, | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|     "nl": "Een kaart om toeristisch relevante info op aan te duiden" | ||||
|   }, | ||||
|   "description": { | ||||
|     "nl": "Op deze kaart kan je info zien die relevant is voor toerisme, zoals:<br/><ul><li>Eetgelegenheden</li><li>Cafés en bars</li><li>(Fiets)oplaadpunten</li><li>Fietspompen, fietserverhuur en fietswinkels</li><li>Uitkijktorens</li><li>...</li></ul> Zie je fouten op de kaart? Dan kan je zelf makkelijk aanpasingen maken, die zichtbaar zijn voor iedereen. Hiervoor dien je een gratis OpenStreetMap account voor te maken." | ||||
|     "nl": "Op deze kaart kan je info zien die relevant is voor toerisme, zoals:<br/><ul><li>Eetgelegenheden</li><li>Cafés en bars</li><li>(Fiets)oplaadpunten</li><li>Fietspompen, fietserverhuur en fietswinkels</li><li>Uitkijktorens</li><li>...</li></ul> Zie je fouten op de kaart? Dan kan je zelf makkelijk aanpasingen maken, die zichtbaar zijn voor iedereen. Hiervoor dien je een gratis OpenStreetMap account voor te maken.<br/><br/>Met de steun van Toerisme Vlaanderen<img src='./assets/themes/toerisme_vlaanderen/logo.png' />" | ||||
|   }, | ||||
|   "descriptionTail": { | ||||
|     "nl": "Met de steun van Toerisme Vlaanderen<img style='height:5rem; width: auto;' src='./assets/themes/toerisme_vlaanderen/logo.png' />" | ||||
|  |  | |||
|  | @ -21,19 +21,9 @@ | |||
|   "widenFactor": 1.01, | ||||
|   "socialImage": "", | ||||
|   "hideFromOverview": true, | ||||
|   "lockLocation": [ | ||||
|     [ | ||||
|       51.51818357322121, | ||||
|       -0.09293317794799805 | ||||
|     ], | ||||
|     [ | ||||
|       51.52898437160955, | ||||
|       -0.08147478103637695 | ||||
|     ] | ||||
|   ], | ||||
|   "clustering": { | ||||
|     "minNeededFeatures": 25, | ||||
|     "maxZoom": 17 | ||||
|     "maxZoom": 16 | ||||
|   }, | ||||
|   "layers": [ | ||||
|     { | ||||
|  |  | |||
|  | @ -219,7 +219,7 @@ function sliceToTiles(allFeatures: FeatureSource, theme: LayoutConfig, relations | |||
|                 } | ||||
|                 // Lets save this tile!
 | ||||
|                 const [z, x, y] = Tiles.tile_from_index(tile.tileIndex) | ||||
|                 console.log("Writing tile ", z, x, y, layerId) | ||||
|                 // console.log("Writing tile ", z, x, y, layerId)
 | ||||
|                 const targetPath = geoJsonName(targetdir + "_" + layerId, x, y, z) | ||||
|                 createdTiles.push(tile.tileIndex) | ||||
|                 // This is the geojson file containing all features for this tile
 | ||||
|  | @ -241,6 +241,7 @@ function sliceToTiles(allFeatures: FeatureSource, theme: LayoutConfig, relations | |||
|             } | ||||
|             perX[key].push(y) | ||||
|         }) | ||||
|         console.log("Written overview: ", path, "with ", createdTiles.length, "tiles") | ||||
|         writeFileSync(path, JSON.stringify(perX)) | ||||
| 
 | ||||
|         // And, if needed, to create a points-only layer
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue