diff --git a/assets/layers/crossings/crossing_unmarked.png b/assets/layers/crossings/crossing_unmarked.png new file mode 100644 index 000000000..629009d32 Binary files /dev/null and b/assets/layers/crossings/crossing_unmarked.png differ diff --git a/assets/layers/crossings/crossing_unmarked.png.license b/assets/layers/crossings/crossing_unmarked.png.license new file mode 100644 index 000000000..8bbbce063 --- /dev/null +++ b/assets/layers/crossings/crossing_unmarked.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: StenSoft +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/crossings.json b/assets/layers/crossings/crossings.json index 2cd743b98..f4b7d4594 100644 --- a/assets/layers/crossings/crossings.json +++ b/assets/layers/crossings/crossings.json @@ -222,49 +222,181 @@ "fr": "Passage piéton sans marquages", "ca": "Creuament sense senyalitzar", "cs": "Přechod bez označení přechodu" - } + }, + "hideInAnswer": true } ] }, { - "id": "crossing-is-zebra", + "id": "markings", "question": { - "en": "Is this is a zebra crossing?", - "nl": "Is dit een zebrapad?", - "de": "Ist das ein Zebrastreifen?", - "es": "¿Esto es un paso de cebra?", - "fr": "Est-ce un passage piéton ?", - "ca": "Açò és un pas de vianants?", - "pl": "Czy to jest przejście dla pieszych typu \"zebra\"?", - "cs": "Jedná se o zebra přechod?" + "en": "What kind of markings does this crossing have?", + "nl": "Wat voor markering heeft deze oversteekplaats?" }, - "condition": "crossing=uncontrolled", "mappings": [ { - "if": "crossing_ref=zebra", + "if": "crossing:markings=no", "then": { - "en": "This is a zebra crossing", - "nl": "Dit is een zebrapad", - "de": "Dies ist ein Zebrastreifen", - "es": "Esto es un paso de cebra", - "fr": "C'est un passage piéton", - "ca": "Açò és un pas de vianants", - "cs": "Toto je zebra přechod" + "en": "This crossing has no markings", + "nl": "Deze oversteekplaats heeft geen markeringen" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/crossing_unmarked.png" } }, { - "if": "crossing_ref=", + "if": "crossing:markings=zebra", "then": { - "en": "This is not a zebra crossing", - "nl": "Dit is geen zebrapad", - "de": "Dies ist kein Zebrastreifen", - "es": "Esto no es un paso de cebra", - "fr": "Ce n'est pas un passage piéton", - "ca": "Açò no és un pas de vianants", - "cs": "Tohle není zebra přechod" + "en": "This crossing has zebra markings", + "nl": "Deze oversteekplaats heeft een zebramarkering" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_zebra.png" + } + }, + { + "hideInAnswer": true, + "then": { + "en": "This crossing has markings of an unknown type", + "nl": "Deze oversteekplaats heeft markeringen van een onbekend type" + }, + "if": "crossing:markings=yes" + }, + { + "if": "crossing:markings=lines", + "then": { + "en": "This crossings has lines on either side of the crossing", + "nl": "Deze oversteekplaats heeft lijnen aan beide kanten van de oversteekplaats" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_lines.png" + } + }, + { + "if": "crossing:markings=ladder", + "then": { + "en": "This crossing has lines on either side of the crossing, along with bars connecting them", + "nl": "Deze oversteekplaats heeft lijnen aan beide kanten van de oversteekplaats, met strepen die ze verbinden" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_ladder.png" + } + }, + { + "if": "crossing:markings=dashes", + "then": { + "en": "This crossing has dashed lines on either sides of the crossing", + "nl": "Deze oversteekplaats heeft onderbroken lijnen aan beide kanten van de oversteekplaats" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_dashes.png" + } + }, + { + "if": "crossing:markings=dots", + "then": { + "en": "This crossing has dotted lines on either sides of the crossing", + "nl": "Deze oversteekplaats heeft stippellijnen aan beide kanten van de oversteekplaats" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_dots.png" + } + }, + { + "if": "crossing:markings=surface", + "then": { + "en": "This crossing is marked by using a different coloured surface", + "nl": "Deze oversteekplaats is gemarkeerd door een anders gekleurd wegdek" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_surface.png" + } + }, + { + "if": "crossing:markings=ladder:skewed", + "then": { + "en": "This crossing has lines on either side of the crossing, along with angled bars connecting them", + "nl": "Deze oversteekplaats heeft lijnen aan beide kanten van de oversteekplaats, met schuine strepen die ze verbinden" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_ladder_skewed.png" + } + }, + { + "if": "crossing:markings=zebra:paired", + "then": { + "en": "This crossing has zebra markings with an interruption in every bar", + "nl": "Deze oversteekplaats heeft zebramarkeringen met een onderbreking van elke streep" + } + }, + { + "if": "crossing:markings=zebra:bicolour", + "then": { + "en": "This crossing has zebra markings in alternating colours", + "nl": "Deze oversteekplaats heeft een zebramarkering in afwisselende kleuren" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_zebra_bicolour.png" + } + }, + { + "if": "crossing:markings=zebra:double", + "then": { + "en": "This crossing has double zebra markings", + "nl": "Deze oversteekplaats heeft een dubbele zebramarkering" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_zebra_double.png" + } + }, + { + "if": "crossing:markings=pictograms", + "then": { + "en": "This crossing has pictograms on the road", + "nl": "Deze oversteekplaats heeft pictogrammen op de weg" + } + }, + { + "if": "crossing:markings=ladder:paired", + "then": { + "en": "This crossing has lines on either side of the crossing, along with bars connecting them, with an interruption in every bar", + "nl": "Deze oversteekplaats heeft lijnen aan beide kanten van de oversteekplaats, met strepen die ze verbinden, met een onderbreking van elke streep" + } + }, + { + "if": "crossing:markings=lines:paired", + "then": { + "en": "This crossing has double lines on either side of the crossing", + "nl": "Deze oversteekplaats heeft dubbele lijnen aan beide kanten van de oversteekplaats" + }, + "icon": { + "class": "large", + "path": "./assets/layers/crossings/markings_lines_paired.png" } } - ] + ], + "render": { + "en": "This crossing has {crossing:markings} markings", + "nl": "Deze oversteekplaats heeft {crossing:markings} markeringen" + }, + "freeform": { + "key": "crossing:markings", + "type": "string", + "addExtraTags": [ + "fixme=Free-form value used in MapComplete for crossing:markings" + ] + }, + "multiAnswer": true }, { "id": "crossing-bicycle-allowed", @@ -732,4 +864,4 @@ "enableImproveAccuracy": true, "enableRelocation": false } -} +} \ No newline at end of file diff --git a/assets/layers/crossings/license_info.json b/assets/layers/crossings/license_info.json index 22105ed13..cfed79075 100644 --- a/assets/layers/crossings/license_info.json +++ b/assets/layers/crossings/license_info.json @@ -39,6 +39,116 @@ "https://wiki.openstreetmap.org/wiki/File:Vibrating_button_illustration.jpg" ] }, + { + "path": "crossing_unmarked.png", + "license": "CC0 1.0", + "authors": [ + "StenSoft" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Crossing_without_markings.png" + ] + }, + { + "path": "markings_dashes.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_dashes.png" + ] + }, + { + "path": "markings_dots.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_dots.png" + ] + }, + { + "path": "markings_ladder.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_ladder.png" + ] + }, + { + "path": "markings_ladder_skewed.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_adder_skewed.png" + ] + }, + { + "path": "markings_lines.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_lines.png" + ] + }, + { + "path": "markings_lines_paired.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_lines_paired.png" + ] + }, + { + "path": "markings_surface.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Surface_crossing_markings.png" + ] + }, + { + "path": "markings_zebra.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_zebra.png" + ] + }, + { + "path": "markings_zebra_bicolour.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Markings_zebra_bicolour.png" + ] + }, + { + "path": "markings_zebra_double.png", + "license": "CC0 1.0", + "authors": [ + "Popball" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Crossing_markings_zebra_double.png" + ] + }, { "path": "pedestrian_crossing.svg", "license": "CC-BY-SA-4.0", diff --git a/assets/layers/crossings/markings_dashes.png b/assets/layers/crossings/markings_dashes.png new file mode 100644 index 000000000..e562679c1 Binary files /dev/null and b/assets/layers/crossings/markings_dashes.png differ diff --git a/assets/layers/crossings/markings_dashes.png.license b/assets/layers/crossings/markings_dashes.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_dashes.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_dots.png b/assets/layers/crossings/markings_dots.png new file mode 100644 index 000000000..afd399b52 Binary files /dev/null and b/assets/layers/crossings/markings_dots.png differ diff --git a/assets/layers/crossings/markings_dots.png.license b/assets/layers/crossings/markings_dots.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_dots.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_ladder.png b/assets/layers/crossings/markings_ladder.png new file mode 100644 index 000000000..0cee129af Binary files /dev/null and b/assets/layers/crossings/markings_ladder.png differ diff --git a/assets/layers/crossings/markings_ladder.png.license b/assets/layers/crossings/markings_ladder.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_ladder.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_ladder_skewed.png b/assets/layers/crossings/markings_ladder_skewed.png new file mode 100644 index 000000000..a9d717d42 Binary files /dev/null and b/assets/layers/crossings/markings_ladder_skewed.png differ diff --git a/assets/layers/crossings/markings_ladder_skewed.png.license b/assets/layers/crossings/markings_ladder_skewed.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_ladder_skewed.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_lines.png b/assets/layers/crossings/markings_lines.png new file mode 100644 index 000000000..cbd7a9ec6 Binary files /dev/null and b/assets/layers/crossings/markings_lines.png differ diff --git a/assets/layers/crossings/markings_lines.png.license b/assets/layers/crossings/markings_lines.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_lines.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_lines_paired.png b/assets/layers/crossings/markings_lines_paired.png new file mode 100644 index 000000000..f33af47db Binary files /dev/null and b/assets/layers/crossings/markings_lines_paired.png differ diff --git a/assets/layers/crossings/markings_lines_paired.png.license b/assets/layers/crossings/markings_lines_paired.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_lines_paired.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_surface.png b/assets/layers/crossings/markings_surface.png new file mode 100644 index 000000000..f0048c67c Binary files /dev/null and b/assets/layers/crossings/markings_surface.png differ diff --git a/assets/layers/crossings/markings_surface.png.license b/assets/layers/crossings/markings_surface.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_surface.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_zebra.png b/assets/layers/crossings/markings_zebra.png new file mode 100644 index 000000000..6588af96f Binary files /dev/null and b/assets/layers/crossings/markings_zebra.png differ diff --git a/assets/layers/crossings/markings_zebra.png.license b/assets/layers/crossings/markings_zebra.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_zebra.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_zebra_bicolour.png b/assets/layers/crossings/markings_zebra_bicolour.png new file mode 100644 index 000000000..2e77a1996 Binary files /dev/null and b/assets/layers/crossings/markings_zebra_bicolour.png differ diff --git a/assets/layers/crossings/markings_zebra_bicolour.png.license b/assets/layers/crossings/markings_zebra_bicolour.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_zebra_bicolour.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/crossings/markings_zebra_double.png b/assets/layers/crossings/markings_zebra_double.png new file mode 100644 index 000000000..6ab4c3a0b Binary files /dev/null and b/assets/layers/crossings/markings_zebra_double.png differ diff --git a/assets/layers/crossings/markings_zebra_double.png.license b/assets/layers/crossings/markings_zebra_double.png.license new file mode 100644 index 000000000..09b78e137 --- /dev/null +++ b/assets/layers/crossings/markings_zebra_double.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Popball +SPDX-License-Identifier: CC0 1.0 \ No newline at end of file diff --git a/assets/layers/cyclist_waiting_aid/waiting_aid.svg.license b/assets/layers/cyclist_waiting_aid/waiting_aid.svg.license index 2c50b6981..75299f884 100644 --- a/assets/layers/cyclist_waiting_aid/waiting_aid.svg.license +++ b/assets/layers/cyclist_waiting_aid/waiting_aid.svg.license @@ -1,2 +1,2 @@ SPDX-FileCopyrightText: Robin van der Linde -SPDX-License-Identifier: CC0 \ No newline at end of file +SPDX-License-Identifier: CC0-1.0 \ No newline at end of file diff --git a/scripts/moveImage.ts b/scripts/moveImage.ts new file mode 100644 index 000000000..989883eee --- /dev/null +++ b/scripts/moveImage.ts @@ -0,0 +1,91 @@ +import { existsSync, renameSync, readFileSync, writeFileSync } from "fs" +import SmallLicense from "../src/Models/smallLicense" + +/** + * Script to move/rename image files + * Useful after downloading images from wikimedia commons + * Apart from moving the image files, this will also update the license file + * + * This will NOT update any images in the theme + */ + +function main(args: string[]) { + // Check if the correct number of arguments are passed + if (args.length != 2) { + console.log("Usage: moveImage.ts oldPath newPath") + console.log("You passed in the arguments: " + args.join(",")) + console.log("Example: npx vite-node scripts/moveImage.ts images/old.jpg images/new.jpg") + return + } + const [oldPath, newPath] = args + + // Check if the oldPath exists + if (!existsSync(oldPath)) { + console.log("The oldPath does not exist: " + oldPath) + return + } + + // Move file + renameSync(oldPath, newPath) + + // If it exists also move the .license file + const oldLicensePath = oldPath + ".license" + if (existsSync(oldLicensePath)) { + const newLicensePath = newPath + ".license" + renameSync(oldLicensePath, newLicensePath) + } + + console.log("Moved file from " + oldPath + " to " + newPath) + + // Open license_info.json in the same directory as the old file + const licensePath = oldPath.replace(/\/[^/]+$/, "/license_info.json") + if (!existsSync(licensePath)) { + console.log( + "The license file does not exist: " + + licensePath + + ". Skipping writing to license file." + ) + return + } + + // Read license file + const licenseFile = readFileSync(licensePath, "utf8") + const licenseInfo = JSON.parse(licenseFile) as SmallLicense[] + + // Find correct license item + const licenseItem = licenseInfo.find((item) => item.path === oldPath.replace(/.*\//, "")) + + // Filter out license item + const newLicenseInfo = licenseInfo.filter((item) => item.path !== oldPath.replace(/.*\//, "")) + const newLicenseFile = JSON.stringify(newLicenseInfo, null, 2) + + // Write new license file + writeFileSync(licensePath, newLicenseFile) + + // Look for a license_info.json file in the new path + const newLicensePath = newPath.replace(/\/[^/]+$/, "/license_info.json") + if (!existsSync(newLicensePath) && licenseItem) { + console.log("License file doesn't exist yet, creating new one: " + newLicensePath) + + // Create new license item + const newLicenseItem = licenseItem + newLicenseItem.path = newPath.replace(/.*\//, "") + + // Create file + writeFileSync(newLicensePath, JSON.stringify([newLicenseItem], null, 2)) + } else if (licenseItem) { + console.log("Appending to existing license file: " + newLicensePath) + + // Create new license item + const newLicenseItem = licenseItem + newLicenseItem.path = newPath.replace(/.*\//, "") + + // Append to existing file + const newLicenseFile = readFileSync(newLicensePath, "utf8") + const newLicenseInfo = JSON.parse(newLicenseFile) as SmallLicense[] + newLicenseInfo.push(newLicenseItem) + writeFileSync(newLicensePath, JSON.stringify(newLicenseInfo, null, 2)) + } +} + +main(process.argv.slice(2))