diff --git a/assets/themes/hailhydrant/British_Columbia_W-318-L.svg b/assets/themes/hailhydrant/British_Columbia_W-318-L.svg
new file mode 100644
index 0000000..11beaf4
--- /dev/null
+++ b/assets/themes/hailhydrant/British_Columbia_W-318-L.svg
@@ -0,0 +1,35 @@
+
+
\ No newline at end of file
diff --git a/assets/themes/hailhydrant/Emojione_1F6A8.svg b/assets/themes/hailhydrant/Emojione_1F6A8.svg
new file mode 100644
index 0000000..2a00519
--- /dev/null
+++ b/assets/themes/hailhydrant/Emojione_1F6A8.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/themes/hailhydrant/Hydrant_02.svg b/assets/themes/hailhydrant/Hydrant_02.svg
new file mode 100644
index 0000000..257691f
--- /dev/null
+++ b/assets/themes/hailhydrant/Hydrant_02.svg
@@ -0,0 +1,526 @@
+
+
diff --git a/assets/themes/hailhydrant/MUTCD_RS-090.svg b/assets/themes/hailhydrant/MUTCD_RS-090.svg
new file mode 100644
index 0000000..21f349c
--- /dev/null
+++ b/assets/themes/hailhydrant/MUTCD_RS-090.svg
@@ -0,0 +1,90 @@
+
+
diff --git a/assets/themes/hailhydrant/hailhydrant.json b/assets/themes/hailhydrant/hailhydrant.json
index 667d79d..c4c0e7e 100644
--- a/assets/themes/hailhydrant/hailhydrant.json
+++ b/assets/themes/hailhydrant/hailhydrant.json
@@ -27,11 +27,6 @@
"en": "Map of hydrants"
},
"minzoom": 14,
- "overpassTags": {
- "and": [
- "emergency=fire_hydrant"
- ]
- },
"title": {
"render": {
"en": "Hydrant"
@@ -92,7 +87,7 @@
]
},
"then": {
- "en": " Pillar type."
+ "en": " Pillar type."
}
},
{
@@ -102,7 +97,7 @@
]
},
"then": {
- "en": " Pipe type."
+ "en": " Pipe type."
}
},
{
@@ -112,7 +107,7 @@
]
},
"then": {
- "en": " Wall type."
+ "en": " Wall type."
}
},
{
@@ -122,7 +117,7 @@
]
},
"then": {
- "en": " Underground type."
+ "en": " Underground type."
}
}
]
@@ -175,7 +170,7 @@
],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
- "render": "https://upload.wikimedia.org/wikipedia/commons/6/66/Hydrant_02.svg"
+ "render": "Hydrant_02.svg"
},
"width": {
"render": "8"
@@ -206,6 +201,13 @@
"emergency=fire_hydrant"
]
}
+ },
+ "source": {
+ "osmTags": {
+ "and": [
+ "emergency=fire_hydrant"
+ ]
+ }
}
},
{
@@ -214,11 +216,6 @@
"en": "Map of fire extinguishers."
},
"minzoom": 14,
- "overpassTags": {
- "and": [
- "emergency=fire_extinguisher"
- ]
- },
"title": {
"render": {
"en": "Extinguishers"
@@ -264,7 +261,7 @@
],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
- "render": "https://upload.wikimedia.org/wikipedia/commons/e/e8/MUTCD_RS-090.svg"
+ "render": "MUTCD_RS-090.svg"
},
"width": {
"render": "8"
@@ -295,6 +292,13 @@
"emergency=fire_extinguisher"
]
}
+ },
+ "source": {
+ "osmTags": {
+ "and": [
+ "emergency=fire_extinguisher"
+ ]
+ }
}
},
{
@@ -303,11 +307,6 @@
"en": "Map of fire stations"
},
"minzoom": 12,
- "overpassTags": {
- "and": [
- "amenity=fire_station"
- ]
- },
"title": {
"render": {
"en": "Fire Station"
@@ -419,7 +418,7 @@
],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
- "render": "https://upload.wikimedia.org/wikipedia/commons/8/84/British_Columbia_W-318-L.svg"
+ "render": "British_Columbia_W-318-L.svg"
},
"width": {
"render": "8"
@@ -449,6 +448,13 @@
"amenity=fire_station"
]
}
+ },
+ "source": {
+ "osmTags": {
+ "and": [
+ "amenity=fire_station"
+ ]
+ }
}
},
{
@@ -457,11 +463,6 @@
"en": "Map of rescue stations"
},
"minzoom": 12,
- "overpassTags": {
- "and": [
- "amenity=rescue_station"
- ]
- },
"title": {
"render": {
"en": "Rescue Station"
@@ -473,7 +474,7 @@
"tagRenderings": [],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
- "render": "https://upload.wikimedia.org/wikipedia/commons/1/1e/Emojione_1F6A8.svg"
+ "render": "Emojione_1F6A8.svg"
},
"width": {
"render": "8"
@@ -503,11 +504,15 @@
"amenity=rescue_station"
]
}
+ },
+ "source": {
+ "osmTags": {
+ "and": [
+ "amenity=rescue_station"
+ ]
+ }
}
}
],
- "roamingRenderings": [
- {}
- ],
"defaultBackgroundId": "HDM_HOT"
}
diff --git a/assets/themes/hailhydrant/hydrant_pillar.svg b/assets/themes/hailhydrant/hydrant_pillar.svg
new file mode 100644
index 0000000..27ef663
--- /dev/null
+++ b/assets/themes/hailhydrant/hydrant_pillar.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/assets/themes/hailhydrant/hydrant_underground.svg b/assets/themes/hailhydrant/hydrant_underground.svg
new file mode 100644
index 0000000..f7c0f3d
--- /dev/null
+++ b/assets/themes/hailhydrant/hydrant_underground.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/assets/themes/hailhydrant/hydrant_unknown.svg b/assets/themes/hailhydrant/hydrant_unknown.svg
new file mode 100644
index 0000000..10b31cd
--- /dev/null
+++ b/assets/themes/hailhydrant/hydrant_unknown.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/assets/themes/hailhydrant/license_info.json b/assets/themes/hailhydrant/license_info.json
index 28d5111..e643238 100644
--- a/assets/themes/hailhydrant/license_info.json
+++ b/assets/themes/hailhydrant/license_info.json
@@ -1,50 +1,118 @@
[
{
- "authors": ["https://openclipart.org/artist/rones"],
+ "authors": [
+ "https://openclipart.org/artist/rones"
+ ],
"path": "extinguisher.svg",
"license": "CC0",
"sources": [
"https://openclipart.org/detail/315876/fire-extinguisher"
]
},
- {
- "authors": ["https://openclipart.org/artist/j4p4n"],
+ {
+ "authors": [
+ "https://openclipart.org/artist/j4p4n"
+ ],
"path": "yellowfirehydrant.svg",
"license": "CC0",
"sources": [
"https://openclipart.org/detail/326295/yellow-fire-hydrant"
]
},
- {
- "authors": ["https://openclipart.org/artist/TVLuke"],
+ {
+ "authors": [
+ "https://openclipart.org/artist/TVLuke"
+ ],
"path": "fire_brigade.svg",
"license": "CC0",
"sources": [
"https://openclipart.org/detail/318142/fire-brigade"
]
},
- {
- "authors": ["https://openclipart.org/artist/qubodup"],
+ {
+ "authors": [
+ "https://openclipart.org/artist/qubodup"
+ ],
"path": "blue-signal-light.svg",
"license": "CC0",
"sources": [
"https://openclipart.org/detail/177928/blue-signal-light"
]
},
- {
- "authors": ["https://www.mapbox.com/maki-icons/"],
+ {
+ "authors": [
+ "https://www.mapbox.com/maki-icons/"
+ ],
"path": "fire-station-15.svg",
"license": "CC0",
"sources": [
"https://openclipart.org/detail/260728/firestation15"
]
},
- {
- "authors": ["https://openclipart.org/artist/rdevries"],
+ {
+ "authors": [
+ "https://openclipart.org/artist/rdevries"
+ ],
"path": "Fire-truck.svg",
"license": "CC0",
"sources": [
"https://openclipart.org/detail/190874/fire-truck"
]
+ },
+ {
+ "path": "hydrant_pillar.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://mapcomplete.braindeaddev.com/assets/layers/fire/hydrant_pillar.svg"
+ ]
+ },
+ {
+ "path": "hydrant_unknown.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://mapcomplete.braindeaddev.com/assets/layers/fire/hydrant_unknown.svg"
+ ]
+ },
+ {
+ "path": "hydrant_underground.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://mapcomplete.braindeaddev.com/assets/layers/fire/hydrant_underground.svg"
+ ]
+ },
+ {
+ "path": "Hydrant_02.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/6/66/Hydrant_02.svg"
+ ]
+ },
+ {
+ "path": "MUTCD_RS-090.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/e/e8/MUTCD_RS-090.svg"
+ ]
+ },
+ {
+ "path": "British_Columbia_W-318-L.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/8/84/British_Columbia_W-318-L.svg"
+ ]
+ },
+ {
+ "path": "Emojione_1F6A8.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/1/1e/Emojione_1F6A8.svg"
+ ]
}
-]
+]
\ No newline at end of file
diff --git a/generated.license_info.json b/generated.license_info.json
new file mode 100644
index 0000000..83e959f
--- /dev/null
+++ b/generated.license_info.json
@@ -0,0 +1,58 @@
+[
+ {
+ "path": "hydrant_pillar.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://mapcomplete.braindeaddev.com/assets/layers/fire/hydrant_pillar.svg"
+ ]
+ },
+ {
+ "path": "hydrant_unknown.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://mapcomplete.braindeaddev.com/assets/layers/fire/hydrant_unknown.svg"
+ ]
+ },
+ {
+ "path": "hydrant_underground.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://mapcomplete.braindeaddev.com/assets/layers/fire/hydrant_underground.svg"
+ ]
+ },
+ {
+ "path": "Hydrant_02.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/6/66/Hydrant_02.svg"
+ ]
+ },
+ {
+ "path": "MUTCD_RS-090.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/e/e8/MUTCD_RS-090.svg"
+ ]
+ },
+ {
+ "path": "British_Columbia_W-318-L.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/8/84/British_Columbia_W-318-L.svg"
+ ]
+ },
+ {
+ "path": "Emojione_1F6A8.svg",
+ "license": "",
+ "authors": [],
+ "sources": [
+ "https://upload.wikimedia.org/wikipedia/commons/1/1e/Emojione_1F6A8.svg"
+ ]
+ }
+]
\ No newline at end of file
diff --git a/package.json b/package.json
index cc36ca8..fc033d2 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"main": "index.js",
"scripts": {
"increase-memory": "export NODE_OPTIONS=--max_old_space_size=4096",
- "start": "ts-node scripts/generateLayerOverview.ts && npm run increase-memory && parcel *.html UI/** Logic/** assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
+ "start": "ts-node scripts/generateLayerOverview.ts --no-fail && npm run increase-memory && parcel *.html UI/** Logic/** assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"test": "ts-node test/Tag.spec.ts && ts-node test/TagQuestion.spec.ts && ts-node test/ImageSearcher.spec.ts && ts-node test/ImageAttribution.spec.ts",
"generate:editor-layer-index": "cd assets/ && wget https://osmlab.github.io/editor-layer-index/imagery.geojson --output-document=editor-layer-index.json",
"generate:images": "ts-node scripts/generateIncludedImages.ts",
diff --git a/scripts/fixTheme.ts b/scripts/fixTheme.ts
new file mode 100644
index 0000000..80de8a7
--- /dev/null
+++ b/scripts/fixTheme.ts
@@ -0,0 +1,63 @@
+
+/*
+ * This script attempt to automatically fix some basic issues when a theme from the custom generator is loaded
+ */
+import {Utils} from "../Utils"
+Utils.runningFromConsole = true;
+import {readFileSync, writeFileSync} from "fs";
+import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson";
+import {Layer} from "leaflet";
+import LayerConfig from "../Customizations/JSON/LayerConfig";
+import SmallLicense from "../Models/smallLicense";
+
+if(process.argv.length == 2){
+ console.log("USAGE: ts-node scripts/fixTheme ")
+ throw "No path specified"
+}
+
+const path = process.argv[2]
+console.log("Fixing up ", path)
+
+const themeConfigJson : LayoutConfigJson = JSON.parse(readFileSync(path, "UTF8"))
+
+const linuxHints = []
+const licenses : SmallLicense[] = []
+
+const replacements: {source: string, destination: string}[] = []
+
+for (const layerConfigJson of themeConfigJson.layers) {
+ if(typeof (layerConfigJson) === "string"){
+ continue;
+ }
+ if(layerConfigJson["overpassTags"] !== undefined){
+ const tags = layerConfigJson["overpassTags"];
+ layerConfigJson["overpassTags"] = undefined;
+ layerConfigJson["source"] = { osmTags : tags}
+ }
+ // @ts-ignore
+ const layerConfig = new LayerConfig(layerConfigJson, true)
+ const images : string[] = Array.from(layerConfig.ExtractImages())
+ const remoteImages = images.filter(img => img.startsWith("http"))
+ for (const remoteImage of remoteImages) {
+ linuxHints.push("wget " + remoteImage)
+ const imgPath = remoteImage.substring(remoteImage.lastIndexOf("/") + 1)
+ licenses.push({
+ path: imgPath,
+ license: "",
+ authors: [],
+ sources: [remoteImage]
+ })
+ replacements.push({source: remoteImage, destination: imgPath})
+ }
+}
+
+let fixedThemeJson = JSON.stringify(themeConfigJson, null , " ")
+for (const replacement of replacements) {
+ fixedThemeJson = fixedThemeJson.replace(new RegExp(replacement.source, "g"), replacement.destination)
+}
+
+const dir = path.substring(0, path.lastIndexOf("/"))
+writeFileSync(dir + "/generated.license_info.json", JSON.stringify(licenses, null, " "))
+writeFileSync(dir + "/fix_script_"+path.replace(/\//g,"_")+".sh", linuxHints.join("\n"))
+writeFileSync(path+".autofixed.json", fixedThemeJson)
+
\ No newline at end of file
diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts
index 6443266..77d26c2 100644
--- a/scripts/generateLayerOverview.ts
+++ b/scripts/generateLayerOverview.ts
@@ -51,8 +51,6 @@ for (const i in licenses) {
}
const knownPaths = new Set(licensePaths)
-const linuxHints = []
-
function validateLayer(layerJson: LayerConfigJson, context?: string): string[] {
let errorCount = [];
if (layerJson["overpassTags"] !== undefined) {
@@ -65,9 +63,7 @@ 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`)
- }
+ }
for (const image of images) {
if (!knownPaths.has(image)) {
const ctx = context === undefined ? "" : ` in a layer defined in the theme ${context}`
@@ -129,7 +125,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)
diff --git a/scripts/generateLicenseInfo.ts b/scripts/generateLicenseInfo.ts
index 05a00f7..f7c0723 100644
--- a/scripts/generateLicenseInfo.ts
+++ b/scripts/generateLicenseInfo.ts
@@ -193,17 +193,18 @@ writeFileSync("./assets/generated/license_info.json", JSON.stringify(licenseInfo
const artwork = contents.filter(pth => pth.match(/(.svg|.png|.jpg)$/i) != null)
const missingLicenses = missingLicenseInfos(licenseInfos, artwork)
-
+const invalidLicenses = licenseInfos.filter(l => (l.license ?? "") === "").map(l => `License for artwork ${l.path} is empty string or undefined`)
if (process.argv.indexOf("--prompt") >= 0 || process.argv.indexOf("--query") >= 0) {
queryMissingLicenses(missingLicenses)
}
if (missingLicenses.length > 0) {
- const msg = `There are ${missingLicenses.length} licenses missing.`
+ const msg = `There are ${missingLicenses.length} licenses missing and ${invalidLicenses.length} invalid licenses.`
+ console.log( missingLicenses.concat(invalidLicenses).join("\n"))
console.error(msg)
if (process.argv.indexOf("--report") >= 0) {
console.log("Writing report!")
- writeFileSync("missing_licenses.txt", missingLicenses.join("\n"))
+ writeFileSync("missing_licenses.txt", missingLicenses.concat(invalidLicenses).join("\n"))
}
if (process.argv.indexOf("--no-fail") < 0) {
throw msg