From 2f483be00012f8ed41af4ac4465e8f1db452c0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 31 Jul 2022 18:40:55 +0200 Subject: [PATCH] More examples --- example3.yaml | 39 +++++++++++++++++++++++---------------- example4.yaml | 35 +++++++++++++++++++++++++++++++++++ example5.yaml | 29 +++++++++++++++++++++++++++++ roads1.yaml | 20 ++++++++++++++++++++ roads2.yaml | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+), 16 deletions(-) create mode 100644 example4.yaml create mode 100644 example5.yaml create mode 100644 roads1.yaml create mode 100644 roads2.yaml diff --git a/example3.yaml b/example3.yaml index 43e22b2..9f0a16a 100644 --- a/example3.yaml +++ b/example3.yaml @@ -1,20 +1,27 @@ type: overpass -name: - en: Roads # English name of the category +# Adding a category name (in English: "Example 3") +name: + en: Example 3 query: - 9: way[highway~"^(motorway|trunk)$"]; - 11: way[highway~"^(motorway|trunk|primary)$"]; - 13: way[highway~"^(motorway|trunk|primary|secondary|tertiary)$"]; - 15: way[highway~"^(motorway|trunk|primary|secondary|tertiary|road|residential)$"]; + 15: nwr[amenity=fountain] + # This query uses a regular expression to match either fountain or drinking_water: + 17: nwr[amenity~"^(fountain|drinking_water)$"] feature: description: | - {{ tagTrans('highway', tags.highway) }} - markerSymbol: # empty, to hide the marker - listMarkerSymbol: line - style: - width: 4 - color: | - {% if tags.highway == 'motorway' %}#ff0000 - {% elseif tags.highway == 'trunk' %}#ff3f00 - {% elseif tags.highway == 'primary' %}#ff7f00 - {% else %}#ffff00{% endif %} \ No newline at end of file + {{ tagTrans('amenity', tags.amenity) }} + # Here, the correct icon for display is read from the 'const' structure + markerSign: | + {{ const[tags.amenity].icon }} + # We can use different markers depending on the type of item + markerSymbol: | + {{ markerPointer({ fillColor: const[tags.amenity].color }) }} + # This is for the marker in the listing in the sidebar + listMarkerSymbol: | + {{ markerCircle({ fillColor: const[tags.amenity].color }) }} +const: + fountain: + icon: ⛲ + color: '#0000ff' # need to quote, because YAML would treat the color as comment + drinking_water: + icon: 🚰 + color: '#007fff' diff --git a/example4.yaml b/example4.yaml new file mode 100644 index 0000000..ae0fc89 --- /dev/null +++ b/example4.yaml @@ -0,0 +1,35 @@ +type: overpass +name: + en: Example 4 + de: Beispiel 4 +query: + 15: nwr[amenity=fountain] + 17: nwr[amenity~"^(fountain|drinking_water)$"] +feature: + description: | + {{ tagTrans('amenity', tags.amenity) }} + # Here, the correct icon for display is read from the 'const' structure + markerSign: | + {{ const[tags.amenity].icon }} + markerSymbol: | + {{ markerPointer({ fillColor: const[tags.amenity].color }) }} + listMarkerSymbol: | + {{ markerCircle({ fillColor: const[tags.amenity].color }) }} +info: | + + {% for value, data in const if data.zoom <= map.zoom %} + + + + + {% endfor %} +
{{ markerCircle({ fillColor: data.color }) }}
{{ data.icon }}
{{ tagTrans('amenity', value) }}
+const: + fountain: + icon: ⛲ + color: '#0000ff' + zoom: 15 + drinking_water: + icon: 🚰 + color: '#007fff' + zoom: 17 diff --git a/example5.yaml b/example5.yaml new file mode 100644 index 0000000..33d19a2 --- /dev/null +++ b/example5.yaml @@ -0,0 +1,29 @@ +type: overpass +name: + en: Example 5 +query: + 15: nwr[amenity=restaurant] +feature: + description: | + {{ tagTrans('amenity', tags.amenity) }} + # Details are written to the right side of the popup / the box in the list. + # tagTransList is a function, which splits the value by ';' and translates + # each value individually. They are joined as enumeration. + details: | + {{ tagTransList('cuisine', tags.cuisine) }} +filter: + cuisine: + name: "{{ keyTrans('cuisine') }}" + type: select + key: cuisine + op: has # query semicolon-separated lists + values: | + {% for value in const.cuisine %} + + {% endfor %} + + + # The option will be ordered by text content. Set 'weight' option to override order. + # Also, the last two options set an explicit OverpassQL query. +const: + cuisine: ["pizza", "burger", "kebab"] diff --git a/roads1.yaml b/roads1.yaml new file mode 100644 index 0000000..5e7f927 --- /dev/null +++ b/roads1.yaml @@ -0,0 +1,20 @@ +type: overpass +name: + en: Roads 1 # English name of the category +query: + 9: way[highway~"^(motorway|trunk)$"]; + 11: way[highway~"^(motorway|trunk|primary)$"]; + 13: way[highway~"^(motorway|trunk|primary|secondary|tertiary)$"]; + 15: way[highway~"^(motorway|trunk|primary|secondary|tertiary|road|residential)$"]; +feature: + description: | + {{ tagTrans('highway', tags.highway) }} + markerSymbol: # empty, to hide the marker + listMarkerSymbol: line # show a line which is generated from the style + style: + width: 4 + color: | + {% if tags.highway == 'motorway' %}#ff0000 + {% elseif tags.highway == 'trunk' %}#ff3f00 + {% elseif tags.highway == 'primary' %}#ff7f00 + {% else %}#ffff00{% endif %} diff --git a/roads2.yaml b/roads2.yaml new file mode 100644 index 0000000..3a2666c --- /dev/null +++ b/roads2.yaml @@ -0,0 +1,33 @@ +type: overpass +name: + en: Roads 2 # English name of the category +query: + 9: way[highway~"^(motorway|trunk)$"]; + 11: way[highway~"^(motorway|trunk|primary)$"]; + 13: way[highway~"^(motorway|trunk|primary|secondary|tertiary)$"]; + 15: way[highway~"^(motorway|trunk|primary|secondary|tertiary|road|residential)$"]; +feature: + description: | + {{ tagTrans('highway', tags.highway) }} + markerSymbol: # empty, to hide the marker + listMarkerSymbol: line # show a line which is generated from the style + style:casing: + width: 8 + color: '#000000' + pane: casing # use the predefined 'casing' pane, so that this line is below the 'style' + style: + width: 4 + color: | + {{ (const[tags.highway]|default(const.default)).color }} + text: | + {{ tags.name }} + textOffset: -8 +const: + motorway: + color: '#ff0000' + trunk: + color: '#ff3f00' + primary: + color: '#ff7f00' + default: + color: '#ffff00'