forked from MapComplete/MapComplete
Add a few filters to the charging stations layer
This commit is contained in:
parent
d89b754217
commit
26b0db8c58
3 changed files with 117 additions and 6 deletions
|
@ -530,5 +530,71 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"wayHandling": 1
|
||||
"wayHandling": 1,
|
||||
"filter": [
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": {
|
||||
"en": "All vehicle types",
|
||||
"nl": "Alle voertuigen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"question": {
|
||||
"en": "Charging station for bicycles",
|
||||
"nl": "Oplaadpunten voor fietsen"
|
||||
},
|
||||
"osmTags": "bicycle=yes"
|
||||
},
|
||||
{
|
||||
"question": {
|
||||
"en": "Charging station for cars",
|
||||
"nl": "Oplaadpunten voor auto's"
|
||||
},
|
||||
"osmTags": {
|
||||
"or": [
|
||||
"car=yes",
|
||||
"motor_car=yes"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": "All connectors"
|
||||
},
|
||||
{
|
||||
"question": "Has a <b>Schuko wall plug</b> without ground pin (CEE7/4 type F) <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/CEE7_4F.svg'/> connector",
|
||||
"osmTags": "socket:schuko~*"
|
||||
},
|
||||
{
|
||||
"question": "Has a <b>European wall plug</b> with ground pin (CEE7/4 type E) <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/TypeE.svg'/> connector",
|
||||
"osmTags": "socket:typee~*"
|
||||
},
|
||||
{
|
||||
"question": "Has a <b>Chademo</b> (type 4) <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/Chademo_type4.svg'/> connector",
|
||||
"osmTags": "socket:chademo~*"
|
||||
},
|
||||
{
|
||||
"question": "Has a <b>Type 1 with cable</b> (J1772) <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/Type1_J1772.svg'/> connector",
|
||||
"osmTags": "socket:type1_cable~*"
|
||||
},
|
||||
{
|
||||
"question": "Has a <b>Type 1 <i>without</i> cable</b> (J1772) <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/Type1_J1772.svg'/> connector",
|
||||
"osmTags": "socket:type1~*"
|
||||
},
|
||||
{
|
||||
"question": "Has a <b>Type 1 CCS</b> (aka Type 1 Combo) <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/Type1-ccs.svg'/> connector",
|
||||
"osmTags": "socket:type1_combo~*"
|
||||
},
|
||||
{
|
||||
"question": "Has a <b>Tesla Supercharger</b> <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/Tesla-hpwc-model-s.svg'/> connector",
|
||||
"osmTags": "socket:tesla_supercharger~*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -399,5 +399,36 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"wayHandling": 1
|
||||
"wayHandling": 1,
|
||||
"filter": [
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"question": {
|
||||
"en": "All vehicle types",
|
||||
"nl": "Alle voertuigen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"question": {
|
||||
"en": "Charging station for bicycles",
|
||||
"nl": "Oplaadpunten voor fietsen"
|
||||
},
|
||||
"osmTags": "bicycle=yes"
|
||||
},
|
||||
{
|
||||
"question": {
|
||||
"en": "Charging station for cars",
|
||||
"nl": "Oplaadpunten voor auto's"
|
||||
},
|
||||
"osmTags": {
|
||||
"or": [
|
||||
"car=yes",
|
||||
"motor_car=yes"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -8,6 +8,11 @@ function run(file, protojson) {
|
|||
|
||||
const result = []
|
||||
const questions = []
|
||||
const filterOptions: { question: string, osmTags?: string } [] = [
|
||||
{
|
||||
question: "All connectors"
|
||||
}
|
||||
]
|
||||
|
||||
for (const entry of entries) {
|
||||
const [key, image, description, whitelist] = entry.split(",").map(str => str.trim())
|
||||
|
@ -19,12 +24,12 @@ function run(file, protojson) {
|
|||
if: `${key}=1`,
|
||||
ifnot: `${key}=`,
|
||||
then: `<img style='width:3rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/${image}'/> ${description}`,
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (whitelist) {
|
||||
const countries = whitelist.split(";").map(country => "_country!=" + country) //HideInAnswer if it is in the wrong country
|
||||
json["hideInAnswer"] = {or:countries}
|
||||
json["hideInAnswer"] = {or: countries}
|
||||
}
|
||||
|
||||
result.push(json)
|
||||
|
@ -45,6 +50,11 @@ function run(file, protojson) {
|
|||
}
|
||||
|
||||
questions.push(indivQ)
|
||||
|
||||
filterOptions.push({
|
||||
question: `Has a ${description} <img style='width:1rem; margin-left: 1rem; margin-right: 1rem' src='./assets/layers/charging_station/${image}'/> connector`,
|
||||
osmTags: `${key}~*`
|
||||
})
|
||||
}
|
||||
|
||||
const toggles = {
|
||||
|
@ -60,11 +70,15 @@ function run(file, protojson) {
|
|||
console.log(stringified)
|
||||
let proto = readFileSync(protojson, "utf8")
|
||||
proto = proto.replace("$$$", stringified.join(",\n") + ",")
|
||||
writeFileSync("charging_station.json", proto)
|
||||
proto = JSON.parse(proto)
|
||||
proto["filter"].push({
|
||||
options: filterOptions
|
||||
})
|
||||
writeFileSync("charging_station.json", JSON.stringify(proto, undefined, " "))
|
||||
}
|
||||
|
||||
try {
|
||||
run("types.csv","charging_station.protojson")
|
||||
run("types.csv", "charging_station.protojson")
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue