diff --git a/assets/layers/benches/benches.json b/assets/layers/bench/bench.json
similarity index 100%
rename from assets/layers/benches/benches.json
rename to assets/layers/bench/bench.json
diff --git a/assets/layers/benches/benches_at_pt.json b/assets/layers/bench_at_pt/bench_at_pt.json
similarity index 100%
rename from assets/layers/benches/benches_at_pt.json
rename to assets/layers/bench_at_pt/bench_at_pt.json
diff --git a/assets/layers/bike_cafe/bike_cafes.json b/assets/layers/bike_cafe/bike_cafe.json
similarity index 97%
rename from assets/layers/bike_cafe/bike_cafes.json
rename to assets/layers/bike_cafe/bike_cafe.json
index 5a777a724..d95f76308 100644
--- a/assets/layers/bike_cafe/bike_cafes.json
+++ b/assets/layers/bike_cafe/bike_cafe.json
@@ -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": [
diff --git a/assets/layers/bike_shop/bike_shop.json b/assets/layers/bike_shop/bike_shop.json
index bbb94e0d1..8f78c0c58 100644
--- a/assets/layers/bike_shop/bike_shop.json
+++ b/assets/layers/bike_shop/bike_shop.json
@@ -1,5 +1,5 @@
{
- "id": "bike_shops",
+ "id": "bike_shop",
"name": {
"en": "Bike repair/shop",
"nl": "Fietszaak",
diff --git a/assets/layers/cycling_themed_object/cycling_themed_objects.json b/assets/layers/bike_themed_object/bike_themed_object.json
similarity index 94%
rename from assets/layers/cycling_themed_object/cycling_themed_objects.json
rename to assets/layers/bike_themed_object/bike_themed_object.json
index 007e786f7..9d1db2cca 100644
--- a/assets/layers/cycling_themed_object/cycling_themed_objects.json
+++ b/assets/layers/bike_themed_object/bike_themed_object.json
@@ -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"
diff --git a/assets/layers/cycling_themed_object/license_info.json b/assets/layers/bike_themed_object/license_info.json
similarity index 100%
rename from assets/layers/cycling_themed_object/license_info.json
rename to assets/layers/bike_themed_object/license_info.json
diff --git a/assets/layers/cycling_themed_object/other_services.svg b/assets/layers/bike_themed_object/other_services.svg
similarity index 100%
rename from assets/layers/cycling_themed_object/other_services.svg
rename to assets/layers/bike_themed_object/other_services.svg
diff --git a/assets/layers/bird_hide/birdhides.json b/assets/layers/birdhide/birdhide.json
similarity index 97%
rename from assets/layers/bird_hide/birdhides.json
rename to assets/layers/birdhide/birdhide.json
index 0c99c1f3f..71a80d88d 100644
--- a/assets/layers/bird_hide/birdhides.json
+++ b/assets/layers/birdhide/birdhide.json
@@ -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"
}
]
},
diff --git a/assets/layers/bird_hide/birdhide.svg b/assets/layers/birdhide/birdhide.svg
similarity index 100%
rename from assets/layers/bird_hide/birdhide.svg
rename to assets/layers/birdhide/birdhide.svg
diff --git a/assets/layers/bird_hide/birdshelter.svg b/assets/layers/birdhide/birdshelter.svg
similarity index 100%
rename from assets/layers/bird_hide/birdshelter.svg
rename to assets/layers/birdhide/birdshelter.svg
diff --git a/assets/layers/bird_hide/license_info.json b/assets/layers/birdhide/license_info.json
similarity index 100%
rename from assets/layers/bird_hide/license_info.json
rename to assets/layers/birdhide/license_info.json
diff --git a/assets/layers/village_green/grass_in_parks.json b/assets/layers/grass_in_parks/grass_in_parks.json
similarity index 100%
rename from assets/layers/village_green/grass_in_parks.json
rename to assets/layers/grass_in_parks/grass_in_parks.json
diff --git a/assets/layers/information_board/information_board.json b/assets/layers/information_board/information_board.json
index 0ab3c893e..8eec9b686 100644
--- a/assets/layers/information_board/information_board.json
+++ b/assets/layers/information_board/information_board.json
@@ -1,5 +1,5 @@
{
- "id": "information_boards",
+ "id": "information_board",
"name": {
"nl": "Informatieborden",
"en": "Information boards"
diff --git a/assets/layers/maps/license_info.json b/assets/layers/map/license_info.json
similarity index 100%
rename from assets/layers/maps/license_info.json
rename to assets/layers/map/license_info.json
diff --git a/assets/layers/maps/map-stickered.svg b/assets/layers/map/map-stickered.svg
similarity index 100%
rename from assets/layers/maps/map-stickered.svg
rename to assets/layers/map/map-stickered.svg
diff --git a/assets/layers/maps/maps.json b/assets/layers/map/map.json
similarity index 94%
rename from assets/layers/maps/maps.json
rename to assets/layers/map/map.json
index 6184098bc..adfbf54fd 100644
--- a/assets/layers/maps/maps.json
+++ b/assets/layers/map/map.json
@@ -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"
}
]
},
diff --git a/assets/layers/maps/map.svg b/assets/layers/map/map.svg
similarity index 100%
rename from assets/layers/maps/map.svg
rename to assets/layers/map/map.svg
diff --git a/assets/layers/maps/osm-logo-buggy-attr.svg b/assets/layers/map/osm-logo-buggy-attr.svg
similarity index 100%
rename from assets/layers/maps/osm-logo-buggy-attr.svg
rename to assets/layers/map/osm-logo-buggy-attr.svg
diff --git a/assets/layers/maps/osm-logo-white-bg.svg b/assets/layers/map/osm-logo-white-bg.svg
similarity index 100%
rename from assets/layers/maps/osm-logo-white-bg.svg
rename to assets/layers/map/osm-logo-white-bg.svg
diff --git a/assets/layers/nature_reserve/nature_reserve.json b/assets/layers/nature_reserve/nature_reserve.json
index 4de9ca24e..301fe7d81 100644
--- a/assets/layers/nature_reserve/nature_reserve.json
+++ b/assets/layers/nature_reserve/nature_reserve.json
@@ -1,5 +1,5 @@
{
- "id": "nature_reserves",
+ "id": "nature_reserve",
"name": {
"nl": "Natuurgebied"
},
diff --git a/assets/layers/benches/license_info.json b/assets/layers/picnic_table/license_info.json
similarity index 100%
rename from assets/layers/benches/license_info.json
rename to assets/layers/picnic_table/license_info.json
diff --git a/assets/layers/benches/picnic_tables.json b/assets/layers/picnic_table/picnic_table.json
similarity index 93%
rename from assets/layers/benches/picnic_tables.json
rename to assets/layers/picnic_table/picnic_table.json
index 2264d72f4..cd170df08 100644
--- a/assets/layers/benches/picnic_tables.json
+++ b/assets/layers/picnic_table/picnic_table.json
@@ -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"
diff --git a/assets/layers/benches/picnic_table.svg b/assets/layers/picnic_table/picnic_table.svg
similarity index 100%
rename from assets/layers/benches/picnic_table.svg
rename to assets/layers/picnic_table/picnic_table.svg
diff --git a/assets/layers/public_bookcases/public_bookcases.json b/assets/layers/public_bookcase/public_bookcase.json
similarity index 99%
rename from assets/layers/public_bookcases/public_bookcases.json
rename to assets/layers/public_bookcase/public_bookcase.json
index 13f990e32..1c71537f5 100644
--- a/assets/layers/public_bookcases/public_bookcases.json
+++ b/assets/layers/public_bookcase/public_bookcase.json
@@ -1,5 +1,5 @@
{
- "id": "public_bookcases",
+ "id": "public_bookcase",
"name": {
"en": "Bookcases",
"nl": "Boekenruilkastjes",
diff --git a/assets/layers/surveillance_cameras/surveillance_cameras.json b/assets/layers/surveillance_camera/surveillance_camera.json
similarity index 99%
rename from assets/layers/surveillance_cameras/surveillance_cameras.json
rename to assets/layers/surveillance_camera/surveillance_camera.json
index 5ac7e6d84..96924653b 100644
--- a/assets/layers/surveillance_cameras/surveillance_cameras.json
+++ b/assets/layers/surveillance_camera/surveillance_camera.json
@@ -1,5 +1,5 @@
{
- "id": "surveillance_cameras",
+ "id": "surveillance_camera",
"name": {
"en": "Surveillance camera's",
"nl": "Bewakingscamera's"
diff --git a/assets/layers/toilets/license_info.json b/assets/layers/toilet/license_info.json
similarity index 100%
rename from assets/layers/toilets/license_info.json
rename to assets/layers/toilet/license_info.json
diff --git a/assets/layers/toilets/toilets.json b/assets/layers/toilet/toilet.json
similarity index 97%
rename from assets/layers/toilets/toilets.json
rename to assets/layers/toilet/toilet.json
index 43b2e8e11..dc33a14eb 100644
--- a/assets/layers/toilets/toilets.json
+++ b/assets/layers/toilet/toilet.json
@@ -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"
}
]
},
diff --git a/assets/layers/toilets/toilets.svg b/assets/layers/toilet/toilets.svg
similarity index 100%
rename from assets/layers/toilets/toilets.svg
rename to assets/layers/toilet/toilets.svg
diff --git a/assets/layers/toilets/urinal.svg b/assets/layers/toilet/urinal.svg
similarity index 100%
rename from assets/layers/toilets/urinal.svg
rename to assets/layers/toilet/urinal.svg
diff --git a/assets/layers/toilets/wheelchair.svg b/assets/layers/toilet/wheelchair.svg
similarity index 100%
rename from assets/layers/toilets/wheelchair.svg
rename to assets/layers/toilet/wheelchair.svg
diff --git a/assets/layers/trees/Onroerend_Erfgoed_logo_without_text.svg b/assets/layers/tree_node/Onroerend_Erfgoed_logo_without_text.svg
similarity index 100%
rename from assets/layers/trees/Onroerend_Erfgoed_logo_without_text.svg
rename to assets/layers/tree_node/Onroerend_Erfgoed_logo_without_text.svg
diff --git a/assets/layers/trees/license_info.json b/assets/layers/tree_node/license_info.json
similarity index 100%
rename from assets/layers/trees/license_info.json
rename to assets/layers/tree_node/license_info.json
diff --git a/assets/layers/trees/tree_nodes.json b/assets/layers/tree_node/tree_node.json
similarity index 92%
rename from assets/layers/trees/tree_nodes.json
rename to assets/layers/tree_node/tree_node.json
index 3efd8808a..f6f1ae3f4 100644
--- a/assets/layers/trees/tree_nodes.json
+++ b/assets/layers/tree_node/tree_node.json
@@ -1,5 +1,5 @@
{
- "id": "tree_nodes",
+ "id": "tree_node",
"name": {
"nl": "Boom",
"en": "Tree"
@@ -277,8 +277,8 @@
]
},
"then": {
- "nl": " Erkend als houtig erfgoed door Onroerend Erfgoed Vlaanderen",
- "en": " Registered as heritage by Onroerend Erfgoed Flanders"
+ "nl": " Erkend als houtig erfgoed door Onroerend Erfgoed Vlaanderen",
+ "en": " Registered as heritage by Onroerend Erfgoed Flanders"
}
},
{
@@ -339,8 +339,8 @@
},
{
"render": {
- "nl": " Onroerend Erfgoed-ID: {ref:OnroerendErfgoed}",
- "en": " Onroerend Erfgoed ID: {ref:OnroerendErfgoed}"
+ "nl": " Onroerend Erfgoed-ID: {ref:OnroerendErfgoed}",
+ "en": " Onroerend Erfgoed ID: {ref:OnroerendErfgoed}"
},
"question": {
"nl": "Wat is het ID uitgegeven door Onroerend Erfgoed Vlaanderen?",
diff --git a/assets/themes/benches/benches.json b/assets/themes/benches/benches.json
index e40939f15..aa89c8e2d 100644
--- a/assets/themes/benches/benches.json
+++ b/assets/themes/benches/benches.json
@@ -29,7 +29,7 @@
"widenFactor": 0.05,
"socialImage": "",
"layers": [
- "bench","bench_at_pt","picnic_tables"
+ "bench","bench_at_pt","picnic_table"
],
"roamingRenderings": []
}
diff --git a/assets/themes/bookcases/Bookcases.json b/assets/themes/bookcases/Bookcases.json
index d8e62169e..605eace44 100644
--- a/assets/themes/bookcases/Bookcases.json
+++ b/assets/themes/bookcases/Bookcases.json
@@ -28,6 +28,6 @@
"widenFactor": 0.05,
"roamingRenderings": [],
"layers": [
- "public_bookcases"
+ "public_bookcase"
]
}
\ No newline at end of file
diff --git a/assets/themes/cyclofix/cyclofix.json b/assets/themes/cyclofix/cyclofix.json
index c3b4947f3..854b05aab 100644
--- a/assets/themes/cyclofix/cyclofix.json
+++ b/assets/themes/cyclofix/cyclofix.json
@@ -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": {
diff --git a/assets/themes/maps/maps.json b/assets/themes/maps/maps.json
index cb7f8c711..13505a69a 100644
--- a/assets/themes/maps/maps.json
+++ b/assets/themes/maps/maps.json
@@ -29,7 +29,7 @@
"widenFactor": 0.05,
"socialImage": "",
"layers": [
- "maps"
+ "map"
],
"roamingRenderings": []
}
\ No newline at end of file
diff --git a/assets/themes/nature/nature.json b/assets/themes/nature/nature.json
index e9b5177b3..9aeb9e498 100644
--- a/assets/themes/nature/nature.json
+++ b/assets/themes/nature/nature.json
@@ -22,10 +22,10 @@
"socialImage": "",
"layers": [
"drinking_water",
- "birdhides",
- "maps",
- "information_boards",
- "nature_reserves"
+ "birdhide",
+ "map",
+ "information_board",
+ "nature_reserve"
],
"roamingRenderings": []
}
\ No newline at end of file
diff --git a/assets/themes/surveillance_cameras/surveillance_cameras.json b/assets/themes/surveillance_cameras/surveillance_cameras.json
index f6522fe91..43bd275e7 100644
--- a/assets/themes/surveillance_cameras/surveillance_cameras.json
+++ b/assets/themes/surveillance_cameras/surveillance_cameras.json
@@ -27,7 +27,7 @@
"defaultBackgroundId": "osm",
"layers": [
"direction",
- "surveillance_cameras"
+ "surveillance_camera"
],
"roamingRenderings": []
}
\ No newline at end of file
diff --git a/assets/themes/toilets/toilets.json b/assets/themes/toilets/toilets.json
index f5c38a405..a7c3fadb4 100644
--- a/assets/themes/toilets/toilets.json
+++ b/assets/themes/toilets/toilets.json
@@ -23,6 +23,6 @@
"widenFactor": 0.05,
"icon": "./assets/themes/toilets/toilets.svg",
"layers": [
- "toilets"
+ "toilet"
]
}
\ No newline at end of file
diff --git a/assets/themes/trees/trees.json b/assets/themes/trees/trees.json
index 26ad343ef..646a256fe 100644
--- a/assets/themes/trees/trees.json
+++ b/assets/themes/trees/trees.json
@@ -28,7 +28,7 @@
"maxZoom": 18
},
"layers": [
- "tree_nodes"
+ "tree_node"
],
"roamingRenderings": [],
"defaultBackgroundId": "AGIV"
diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts
index 64432662f..c5f7a5a4b 100644
--- a/scripts/generateLayerOverview.ts
+++ b/scripts/generateLayerOverview.ts
@@ -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(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\": }' instead of \"overpassTags\": (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": "", "authors": [ " ${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();
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)