Move layers to canonical paths, rewrite some regexes as 'or' as to make the taginfo-information more accurate
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "bike_cafes",
|
||||
"id": "bike_cafe",
|
||||
"name": {
|
||||
"en": "Bike cafe",
|
||||
"nl": "Fietscafé",
|
||||
|
@ -11,7 +11,14 @@
|
|||
"source": {
|
||||
"osmTags": {
|
||||
"and": [
|
||||
"amenity~pub|bar|cafe|restaurant",
|
||||
{
|
||||
"or": [
|
||||
"amenity=pub",
|
||||
"amenity=bar",
|
||||
"amenity=cafe",
|
||||
"amenity=restaurant"
|
||||
]
|
||||
},
|
||||
{
|
||||
"#": "Note the double tilde in 'service:bicycle' which interprets the key as regex too",
|
||||
"or": [
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "bike_shops",
|
||||
"id": "bike_shop",
|
||||
"name": {
|
||||
"en": "Bike repair/shop",
|
||||
"nl": "Fietszaak",
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
],
|
||||
"hideUnderlayingFeaturesMinPercentage": 0,
|
||||
"icon": {
|
||||
"render": "./assets/layers/cycling_themed_object/other_services.svg"
|
||||
"render": "./assets/layers/bike_themed_object/other_services.svg"
|
||||
},
|
||||
"width": {
|
||||
"render": "2"
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 995 B |
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "birdhides",
|
||||
"id": "birdhide",
|
||||
"name": {
|
||||
"nl": "Vogelkijkhutten"
|
||||
},
|
||||
|
@ -178,7 +178,7 @@
|
|||
],
|
||||
"icon": {
|
||||
"render": {
|
||||
"nl": "./assets/layers/bird_hide/birdhide.svg"
|
||||
"nl": "./assets/layers/birdhide/birdhide.svg"
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
|
@ -189,7 +189,7 @@
|
|||
"amenity=shelter"
|
||||
]
|
||||
},
|
||||
"then": "./assets/layers/bird_hide/birdshelter.svg"
|
||||
"then": "./assets/layers/birdhide/birdshelter.svg"
|
||||
}
|
||||
]
|
||||
},
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "information_boards",
|
||||
"id": "information_board",
|
||||
"name": {
|
||||
"nl": "Informatieborden",
|
||||
"en": "Information boards"
|
||||
|
|
Before Width: | Height: | Size: 469 KiB After Width: | Height: | Size: 469 KiB |
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "maps",
|
||||
"id": "map",
|
||||
"name": {
|
||||
"en": "Maps",
|
||||
"nl": "Kaarten"
|
||||
|
@ -126,7 +126,7 @@
|
|||
],
|
||||
"hideUnderlayingFeaturesMinPercentage": 0,
|
||||
"icon": {
|
||||
"render": "./assets/layers/maps/map.svg",
|
||||
"render": "./assets/layers/map/map.svg",
|
||||
"mappings": [
|
||||
{
|
||||
"if": {
|
||||
|
@ -135,7 +135,7 @@
|
|||
"map_source:attribution=sticker"
|
||||
]
|
||||
},
|
||||
"then": "./assets/layers/maps/map-stickered.svg"
|
||||
"then": "./assets/layers/map/map-stickered.svg"
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
|
@ -144,7 +144,7 @@
|
|||
"map_source:attribution=yes"
|
||||
]
|
||||
},
|
||||
"then": "./assets/layers/maps/osm-logo-white-bg.svg"
|
||||
"then": "./assets/layers/map/osm-logo-white-bg.svg"
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
|
@ -152,7 +152,7 @@
|
|||
"map_source=OpenStreetMap"
|
||||
]
|
||||
},
|
||||
"then": "./assets/layers/maps/osm-logo-buggy-attr.svg"
|
||||
"then": "./assets/layers/map/osm-logo-buggy-attr.svg"
|
||||
}
|
||||
]
|
||||
},
|
Before Width: | Height: | Size: 297 KiB After Width: | Height: | Size: 297 KiB |
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 159 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "nature_reserves",
|
||||
"id": "nature_reserve",
|
||||
"name": {
|
||||
"nl": "Natuurgebied"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "picnic_tables",
|
||||
"id": "picnic_table",
|
||||
"name": {
|
||||
"en": "Picnic tables",
|
||||
"nl": "Picnictafels"
|
||||
|
@ -51,7 +51,7 @@
|
|||
],
|
||||
"hideUnderlayingFeaturesMinPercentage": 0,
|
||||
"icon": {
|
||||
"render": "circle:#e6cf39;./assets/layers/benches/picnic_table.svg"
|
||||
"render": "circle:#e6cf39;./assets/layers/picnic_table/picnic_table.svg"
|
||||
},
|
||||
"width": {
|
||||
"render": "8"
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "public_bookcases",
|
||||
"id": "public_bookcase",
|
||||
"name": {
|
||||
"en": "Bookcases",
|
||||
"nl": "Boekenruilkastjes",
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "surveillance_cameras",
|
||||
"id": "surveillance_camera",
|
||||
"name": {
|
||||
"en": "Surveillance camera's",
|
||||
"nl": "Bewakingscamera's"
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "toilets",
|
||||
"id": "toilet",
|
||||
"name": {
|
||||
"en": "Toilets",
|
||||
"de": "Toiletten",
|
||||
|
@ -16,15 +16,15 @@
|
|||
}
|
||||
},
|
||||
"icon": {
|
||||
"render": "./assets/layers/toilets/toilets.svg",
|
||||
"render": "./assets/layers/toilet/toilets.svg",
|
||||
"mappings": [
|
||||
{
|
||||
"if": "wheelchair=yes",
|
||||
"then": "./assets/layers/toilets/wheelchair.svg"
|
||||
"then": "./assets/layers/toilet/wheelchair.svg"
|
||||
},
|
||||
{
|
||||
"if": "toilets:position=urinals",
|
||||
"then": "./assets/layers/toilets/urinal.svg"
|
||||
"then": "./assets/layers/toilet/urinal.svg"
|
||||
}
|
||||
]
|
||||
},
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 700 B |
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "tree_nodes",
|
||||
"id": "tree_node",
|
||||
"name": {
|
||||
"nl": "Boom",
|
||||
"en": "Tree"
|
||||
|
@ -277,8 +277,8 @@
|
|||
]
|
||||
},
|
||||
"then": {
|
||||
"nl": "<img src=\"./assets/layers/trees/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Erkend als houtig erfgoed door Onroerend Erfgoed Vlaanderen",
|
||||
"en": "<img src=\"./assets/layers/trees/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Registered as heritage by <i>Onroerend Erfgoed</i> Flanders"
|
||||
"nl": "<img src=\"./assets/layers/tree_node/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Erkend als houtig erfgoed door Onroerend Erfgoed Vlaanderen",
|
||||
"en": "<img src=\"./assets/layers/tree_node/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Registered as heritage by <i>Onroerend Erfgoed</i> Flanders"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -339,8 +339,8 @@
|
|||
},
|
||||
{
|
||||
"render": {
|
||||
"nl": "<img src=\"./assets/layers/trees/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Onroerend Erfgoed-ID: <a href=\"https://id.erfgoed.net/erfgoedobjecten/{ref:OnroerendErfgoed}\">{ref:OnroerendErfgoed}</a>",
|
||||
"en": "<img src=\"./assets/layers/trees/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Onroerend Erfgoed ID: <a href=\"https://id.erfgoed.net/erfgoedobjecten/{ref:OnroerendErfgoed}\">{ref:OnroerendErfgoed}</a>"
|
||||
"nl": "<img src=\"./assets/layers/tree_node/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Onroerend Erfgoed-ID: <a href=\"https://id.erfgoed.net/erfgoedobjecten/{ref:OnroerendErfgoed}\">{ref:OnroerendErfgoed}</a>",
|
||||
"en": "<img src=\"./assets/layers/tree_node/Onroerend_Erfgoed_logo_without_text.svg\" style=\"width:0.85em;height:1em;vertical-align:middle\" alt=\"\"/> Onroerend Erfgoed ID: <a href=\"https://id.erfgoed.net/erfgoedobjecten/{ref:OnroerendErfgoed}\">{ref:OnroerendErfgoed}</a>"
|
||||
},
|
||||
"question": {
|
||||
"nl": "Wat is het ID uitgegeven door Onroerend Erfgoed Vlaanderen?",
|
|
@ -29,7 +29,7 @@
|
|||
"widenFactor": 0.05,
|
||||
"socialImage": "",
|
||||
"layers": [
|
||||
"bench","bench_at_pt","picnic_tables"
|
||||
"bench","bench_at_pt","picnic_table"
|
||||
],
|
||||
"roamingRenderings": []
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
"widenFactor": 0.05,
|
||||
"roamingRenderings": [],
|
||||
"layers": [
|
||||
"public_bookcases"
|
||||
"public_bookcase"
|
||||
]
|
||||
}
|
|
@ -32,8 +32,8 @@
|
|||
"widenFactor": 0.05,
|
||||
"socialImage": "assets/themes/cyclofix/logo.svg",
|
||||
"layers": [
|
||||
"bike_cafes",
|
||||
"bike_shops",
|
||||
"bike_cafe",
|
||||
"bike_shop",
|
||||
{
|
||||
"builtin": "bicycle_library",
|
||||
"override": {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"widenFactor": 0.05,
|
||||
"socialImage": "",
|
||||
"layers": [
|
||||
"maps"
|
||||
"map"
|
||||
],
|
||||
"roamingRenderings": []
|
||||
}
|
|
@ -22,10 +22,10 @@
|
|||
"socialImage": "",
|
||||
"layers": [
|
||||
"drinking_water",
|
||||
"birdhides",
|
||||
"maps",
|
||||
"information_boards",
|
||||
"nature_reserves"
|
||||
"birdhide",
|
||||
"map",
|
||||
"information_board",
|
||||
"nature_reserve"
|
||||
],
|
||||
"roamingRenderings": []
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
"defaultBackgroundId": "osm",
|
||||
"layers": [
|
||||
"direction",
|
||||
"surveillance_cameras"
|
||||
"surveillance_camera"
|
||||
],
|
||||
"roamingRenderings": []
|
||||
}
|
|
@ -23,6 +23,6 @@
|
|||
"widenFactor": 0.05,
|
||||
"icon": "./assets/themes/toilets/toilets.svg",
|
||||
"layers": [
|
||||
"toilets"
|
||||
"toilet"
|
||||
]
|
||||
}
|
|
@ -28,7 +28,7 @@
|
|||
"maxZoom": 18
|
||||
},
|
||||
"layers": [
|
||||
"tree_nodes"
|
||||
"tree_node"
|
||||
],
|
||||
"roamingRenderings": [],
|
||||
"defaultBackgroundId": "AGIV"
|
||||
|
|
|
@ -25,9 +25,9 @@ const layerFiles = ScriptUtils.readDirRecSync("./assets/layers")
|
|||
.map(path => {
|
||||
try {
|
||||
const parsed = JSON.parse(readFileSync(path, "UTF8"));
|
||||
return parsed
|
||||
return {parsed: parsed, path: path}
|
||||
} catch (e) {
|
||||
console.error("Could not parse file ", path, "due to ", e)
|
||||
console.error("Could not parse file ", "./assets/layers/"+ path, "due to ", e)
|
||||
}
|
||||
})
|
||||
const themeFiles: any[] = ScriptUtils.readDirRecSync("./assets/themes")
|
||||
|
@ -37,7 +37,7 @@ const themeFiles: any[] = ScriptUtils.readDirRecSync("./assets/themes")
|
|||
return JSON.parse(readFileSync(path, "UTF8"));
|
||||
})
|
||||
writeFileSync("./assets/generated/known_layers_and_themes.json", JSON.stringify({
|
||||
"layers": layerFiles,
|
||||
"layers": layerFiles.map(l => l.parsed),
|
||||
"themes": themeFiles
|
||||
}))
|
||||
|
||||
|
@ -51,9 +51,7 @@ for (const i in licenses) {
|
|||
}
|
||||
const knownPaths = new Set<string>(licensePaths)
|
||||
|
||||
const linuxHints = []
|
||||
|
||||
function validateLayer(layerJson: LayerConfigJson, context?: string): string[] {
|
||||
function validateLayer(layerJson: LayerConfigJson, path: string, context?: string): string[] {
|
||||
let errorCount = [];
|
||||
if (layerJson["overpassTags"] !== undefined) {
|
||||
errorCount.push("Layer " + layerJson.id + "still uses the old 'overpassTags'-format. Please use \"source\": {\"osmTags\": <tags>}' instead of \"overpassTags\": <tags> (note: this isn't your fault, the custom theme generator still spits out the old format)")
|
||||
|
@ -65,9 +63,13 @@ function validateLayer(layerJson: LayerConfigJson, context?: string): string[] {
|
|||
for (const remoteImage of remoteImages) {
|
||||
errorCount.push("Found a remote image: " + remoteImage + " in layer " + layer.id + ", please download it.")
|
||||
const path = remoteImage.substring(remoteImage.lastIndexOf("/") + 1)
|
||||
linuxHints.push("wget " + remoteImage)
|
||||
linuxHints.push(`echo '{"path":"${path}", "license": "<insert license here>", "authors": [ "<insert author(s) here"], "sources": [${remoteImage}] > ${path}.license_info.json`)
|
||||
}
|
||||
|
||||
const expected : string = `assets/layers/${layer.id}/${layer.id}.json`
|
||||
if(path!=undefined && path.indexOf(expected)< 0){
|
||||
errorCount.push("Layer is in an incorrect place. The path is "+path+", but expected "+expected)
|
||||
}
|
||||
|
||||
for (const image of images) {
|
||||
if (!knownPaths.has(image)) {
|
||||
const ctx = context === undefined ? "" : ` in a layer defined in the theme ${context}`
|
||||
|
@ -76,6 +78,7 @@ function validateLayer(layerJson: LayerConfigJson, context?: string): string[] {
|
|||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return [`Layer ${layerJson.id}` ?? JSON.stringify(layerJson).substring(0, 50) + " is invalid: " + e]
|
||||
}
|
||||
return errorCount
|
||||
|
@ -84,8 +87,8 @@ function validateLayer(layerJson: LayerConfigJson, context?: string): string[] {
|
|||
let layerErrorCount = []
|
||||
const knownLayerIds = new Set<string>();
|
||||
for (const layerFile of layerFiles) {
|
||||
knownLayerIds.add(layerFile.id)
|
||||
layerErrorCount.push(...validateLayer(layerFile))
|
||||
knownLayerIds.add(layerFile.parsed.id)
|
||||
layerErrorCount.push(...validateLayer(layerFile.parsed, layerFile.path))
|
||||
}
|
||||
|
||||
let themeErrorCount = []
|
||||
|
@ -94,7 +97,7 @@ for (const themeFile of themeFiles) {
|
|||
for (const layer of themeFile.layers) {
|
||||
if (typeof layer === "string") {
|
||||
if (!knownLayerIds.has(layer)) {
|
||||
themeErrorCount.push("Unknown layer id: " + layer)
|
||||
themeErrorCount.push(`Unknown layer id: ${layer} in theme ${themeFile.id}`)
|
||||
}
|
||||
} else {
|
||||
if (layer.builtin !== undefined) {
|
||||
|
@ -103,7 +106,7 @@ for (const themeFile of themeFiles) {
|
|||
}
|
||||
} else {
|
||||
// layer.builtin contains layer overrides - we can skip those
|
||||
layerErrorCount.push(...validateLayer(layer, themeFile.id))
|
||||
layerErrorCount.push(...validateLayer(layer,undefined, themeFile.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +132,6 @@ if (layerErrorCount.length + themeErrorCount.length == 0) {
|
|||
console.log(errors)
|
||||
const msg = (`Found ${layerErrorCount.length} errors in the layers; ${themeErrorCount.length} errors in the themes`)
|
||||
console.log(msg)
|
||||
console.log(linuxHints.join("\n"))
|
||||
if (process.argv.indexOf("--report") >= 0) {
|
||||
console.log("Writing report!")
|
||||
writeFileSync("layer_report.txt", errors)
|
||||
|
|