Add crossing:markings question, file move script

This commit is contained in:
Robin van der Linde 2024-10-29 16:02:41 +01:00
parent 8d181c183a
commit ce74412891
No known key found for this signature in database
GPG key ID: 53956B3252478F0D
26 changed files with 385 additions and 30 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: StenSoft
SPDX-License-Identifier: CC0 1.0

View file

@ -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",

View file

@ -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",

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Popball
SPDX-License-Identifier: CC0 1.0

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Robin van der Linde
SPDX-License-Identifier: CC0
SPDX-License-Identifier: CC0-1.0

91
scripts/moveImage.ts Normal file
View file

@ -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))