From 69f21f29eb705875871f079b7b5088ba18519b75 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 13 Oct 2021 03:10:46 +0200 Subject: [PATCH] Dynamic JSON: only request existing tiles if a whitelist is given --- .../TiledFeatureSource/DynamicGeoJsonTileSource.ts | 3 +-- UI/ShowDataLayer/TileHierarchyAggregator.ts | 6 ++---- assets/themes/natuurpunt/natuurpunt.json | 3 +-- .../toerisme_vlaanderen/toerisme_vlaanderen.json | 2 +- assets/themes/uk_addresses/uk_addresses.json | 12 +----------- scripts/generateCache.ts | 3 ++- 6 files changed, 8 insertions(+), 21 deletions(-) diff --git a/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts b/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts index fc110e1c2c..67e57ce7fa 100644 --- a/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts +++ b/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts @@ -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; } } diff --git a/UI/ShowDataLayer/TileHierarchyAggregator.ts b/UI/ShowDataLayer/TileHierarchyAggregator.ts index cdaa5e4206..c8a19ab5fa 100644 --- a/UI/ShowDataLayer/TileHierarchyAggregator.ts +++ b/UI/ShowDataLayer/TileHierarchyAggregator.ts @@ -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 } diff --git a/assets/themes/natuurpunt/natuurpunt.json b/assets/themes/natuurpunt/natuurpunt.json index 54effec905..ba59302079 100644 --- a/assets/themes/natuurpunt/natuurpunt.json +++ b/assets/themes/natuurpunt/natuurpunt.json @@ -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, diff --git a/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json b/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json index 489c36ed7d..ce9864c202 100644 --- a/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json +++ b/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json @@ -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:
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:
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.

Met de steun van Toerisme Vlaanderen" }, "descriptionTail": { "nl": "Met de steun van Toerisme Vlaanderen" diff --git a/assets/themes/uk_addresses/uk_addresses.json b/assets/themes/uk_addresses/uk_addresses.json index 67cf0c6007..273c5f8d9e 100644 --- a/assets/themes/uk_addresses/uk_addresses.json +++ b/assets/themes/uk_addresses/uk_addresses.json @@ -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": [ { diff --git a/scripts/generateCache.ts b/scripts/generateCache.ts index c7fc2f04be..9bf8790233 100644 --- a/scripts/generateCache.ts +++ b/scripts/generateCache.ts @@ -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