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){
|
if(whitelist !== undefined){
|
||||||
const isWhiteListed = whitelist.get(zxy[1])?.has(zxy[2])
|
const isWhiteListed = whitelist.get(zxy[1])?.has(zxy[2])
|
||||||
if(!isWhiteListed){
|
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 self = this
|
||||||
const empty = []
|
const empty = []
|
||||||
return new StaticFeatureSource(
|
return new StaticFeatureSource(
|
||||||
locationControl.map(loc => {
|
locationControl.map(loc => loc.zoom).map(targetZoom => {
|
||||||
const targetZoom = loc.zoom
|
if(targetZoom-1 > clusteringConfig.maxZoom){
|
||||||
|
|
||||||
if(targetZoom > clusteringConfig.maxZoom){
|
|
||||||
return empty
|
return empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"enablePdfDownload": true,
|
"enablePdfDownload": true,
|
||||||
"enableDownload": true,
|
"enableDownload": true,
|
||||||
"hideFromOverview": true,
|
"hideFromOverview": true,
|
||||||
"#": "Disable clustering for this theme",
|
"#": "Disable clustering for this theme",
|
||||||
"clustering": {
|
"clustering": {
|
||||||
"maxZoom": 0
|
"maxZoom": 0
|
||||||
},
|
},
|
||||||
|
@ -71,7 +71,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"geoJson": "https://pietervdvn.github.io/natuurpunt_cache/natuurpunt_nature_reserve_points.geojson",
|
"geoJson": "https://pietervdvn.github.io/natuurpunt_cache/natuurpunt_nature_reserve_points.geojson",
|
||||||
"geoJsonZoomLevel": 0,
|
|
||||||
"isOsmCache": "duplicate"
|
"isOsmCache": "duplicate"
|
||||||
},
|
},
|
||||||
"minzoom": 1,
|
"minzoom": 1,
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"nl": "Een kaart om toeristisch relevante info op aan te duiden"
|
"nl": "Een kaart om toeristisch relevante info op aan te duiden"
|
||||||
},
|
},
|
||||||
"description": {
|
"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": {
|
"descriptionTail": {
|
||||||
"nl": "Met de steun van Toerisme Vlaanderen<img style='height:5rem; width: auto;' src='./assets/themes/toerisme_vlaanderen/logo.png' />"
|
"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,
|
"widenFactor": 1.01,
|
||||||
"socialImage": "",
|
"socialImage": "",
|
||||||
"hideFromOverview": true,
|
"hideFromOverview": true,
|
||||||
"lockLocation": [
|
|
||||||
[
|
|
||||||
51.51818357322121,
|
|
||||||
-0.09293317794799805
|
|
||||||
],
|
|
||||||
[
|
|
||||||
51.52898437160955,
|
|
||||||
-0.08147478103637695
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"clustering": {
|
"clustering": {
|
||||||
"minNeededFeatures": 25,
|
"minNeededFeatures": 25,
|
||||||
"maxZoom": 17
|
"maxZoom": 16
|
||||||
},
|
},
|
||||||
"layers": [
|
"layers": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -219,7 +219,7 @@ function sliceToTiles(allFeatures: FeatureSource, theme: LayoutConfig, relations
|
||||||
}
|
}
|
||||||
// Lets save this tile!
|
// Lets save this tile!
|
||||||
const [z, x, y] = Tiles.tile_from_index(tile.tileIndex)
|
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)
|
const targetPath = geoJsonName(targetdir + "_" + layerId, x, y, z)
|
||||||
createdTiles.push(tile.tileIndex)
|
createdTiles.push(tile.tileIndex)
|
||||||
// This is the geojson file containing all features for this tile
|
// 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)
|
perX[key].push(y)
|
||||||
})
|
})
|
||||||
|
console.log("Written overview: ", path, "with ", createdTiles.length, "tiles")
|
||||||
writeFileSync(path, JSON.stringify(perX))
|
writeFileSync(path, JSON.stringify(perX))
|
||||||
|
|
||||||
// And, if needed, to create a points-only layer
|
// And, if needed, to create a points-only layer
|
||||||
|
|
Loading…
Reference in a new issue