diff --git a/assets/layers/charging_station/charging_station.json b/assets/layers/charging_station/charging_station.json index f3a2137001..bcd2e66593 100644 --- a/assets/layers/charging_station/charging_station.json +++ b/assets/layers/charging_station/charging_station.json @@ -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 Schuko wall plug without ground pin (CEE7/4 type F) connector", + "osmTags": "socket:schuko~*" + }, + { + "question": "Has a European wall plug with ground pin (CEE7/4 type E) connector", + "osmTags": "socket:typee~*" + }, + { + "question": "Has a Chademo (type 4) connector", + "osmTags": "socket:chademo~*" + }, + { + "question": "Has a Type 1 with cable (J1772) connector", + "osmTags": "socket:type1_cable~*" + }, + { + "question": "Has a Type 1 without cable (J1772) connector", + "osmTags": "socket:type1~*" + }, + { + "question": "Has a Type 1 CCS (aka Type 1 Combo) connector", + "osmTags": "socket:type1_combo~*" + }, + { + "question": "Has a Tesla Supercharger connector", + "osmTags": "socket:tesla_supercharger~*" + } + ] + } + ] } \ No newline at end of file diff --git a/assets/layers/charging_station/charging_station.protojson b/assets/layers/charging_station/charging_station.protojson index 67bf0d8842..bc1cbc5078 100644 --- a/assets/layers/charging_station/charging_station.protojson +++ b/assets/layers/charging_station/charging_station.protojson @@ -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" + ] + } + } + ] + } + ] } diff --git a/assets/layers/charging_station/csvToJson.ts b/assets/layers/charging_station/csvToJson.ts index eab74618ec..894b7674a7 100644 --- a/assets/layers/charging_station/csvToJson.ts +++ b/assets/layers/charging_station/csvToJson.ts @@ -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: ` ${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} 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) }