diff --git a/assets/layers/maxspeed/maxspeed.json b/assets/layers/maxspeed/maxspeed.json index 6f8629560..2e255a31c 100644 --- a/assets/layers/maxspeed/maxspeed.json +++ b/assets/layers/maxspeed/maxspeed.json @@ -102,7 +102,13 @@ "render": "#000000", "mappings": [ { - "if": "maxspeed=", + "if": { + "and": [ + "maxspeed=", + "maxspeed:forward=", + "maxspeed:backward=" + ] + }, "then": "#ff0000" } ] @@ -112,6 +118,7 @@ ], "tagRenderings": [ { + "id": "maxspeed-maxspeed", "render": { "en": "The maximum allowed speed on this road is {canonical(maxspeed)}", "de": "Die zulässige Höchstgeschwindigkeit auf dieser Straße beträgt {canonical(maxspeed)}", @@ -135,7 +142,10 @@ }, "freeform": { "key": "maxspeed", - "type": "pnat" + "type": "pnat", + "addExtraTags": [ + "_forward_backward=no" + ] }, "mappings": [ { @@ -162,9 +172,70 @@ "maxspeed=20" ], "hideInAnswer": "_country!=be" + }, + { + "if": { + "and": [ + "maxspeed=", + "_forward_backward=yes" + ] + }, + "then": { + "en": "The maximum allowed speed on this road depends on the direction a vehicle goes" + } } ], - "id": "maxspeed-maxspeed" + "condition": { + "or": [ + "maxspeed~*", + { + "and": [ + "maxspeed:forward=", + "maxspeed:backward=" + ] + } + ] + } + }, + { + "id": "maxspeed-forward", + "condition": { + "or": [ + "maxspeed:backward~*", + "maxspeed:forward~*", + "_forward_backward=yes" + ] + }, + "question": { + "en": "What is the maximum allowed speed when travelling {direction_absolute()}?" + }, + "render": { + "en": "The maximum allowed speed when travelling {direction_absolute()} on this road is {canonical(maxspeed:forward)}" + }, + "freeform": { + "key": "maxspeed:forward", + "type": "pnat" + } + }, + { + "id": "maxspeed-backward", + "condition": { + "or": [ + "maxspeed:forward~*", + "maxspeed:backward~*", + "_forward_backward=yes" + ] + }, + "question": { + "en": "What is the maximum allowed speed when travelling {direction_absolute(,180)}?" + }, + "render": { + "en": "The maximum allowed speed when travelling {direction_absolute(,180)} on this road is {canonical(maxspeed:backward)}" + }, + "freeform": { + "key": "maxspeed:backward", + "type": "pnat" + } } ], "allowMove": false, @@ -177,6 +248,20 @@ "denominations": [ "mph" ] + }, + "maxspeed:forward": { + "quantity": "speed", + "canonical": "kmh", + "denominations": [ + "mph" + ] + }, + "maxspeed:backward": { + "quantity": "speed", + "canonical": "kmh", + "denominations": [ + "mph" + ] } } ] diff --git a/src/Logic/Osm/Changes.ts b/src/Logic/Osm/Changes.ts index 34a498afc..ed2b8c1f4 100644 --- a/src/Logic/Osm/Changes.ts +++ b/src/Logic/Osm/Changes.ts @@ -445,6 +445,10 @@ export class Changes { // Apply tag changes for (const kv of change.tags ?? []) { const k = kv.k + if (k.startsWith("_")) { + // These values are ignored later on anyways + continue + } let v = kv.v if (v === "") { diff --git a/src/UI/Popup/TagHint.svelte b/src/UI/Popup/TagHint.svelte index 49549507c..3954d8ef2 100644 --- a/src/UI/Popup/TagHint.svelte +++ b/src/UI/Popup/TagHint.svelte @@ -14,6 +14,8 @@ {#if tags?.length > 0} +