Browse Source

More examples

master
parent
commit
2f483be000
  1. 39
      example3.yaml
  2. 35
      example4.yaml
  3. 29
      example5.yaml
  4. 20
      roads1.yaml
  5. 33
      roads2.yaml

39
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 %}
{{ 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'

35
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: |
<table>
{% for value, data in const if data.zoom <= map.zoom %}
<tr>
<td>{{ markerCircle({ fillColor: data.color }) }}<div class='sign'>{{ data.icon }}</div></td>
<td>{{ tagTrans('amenity', value) }}</td>
</tr>
{% endfor %}
</table>
const:
fountain:
icon:
color: '#0000ff'
zoom: 15
drinking_water:
icon: 🚰
color: '#007fff'
zoom: 17

29
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 %}
<option value='{{ value }}'>{{ tagTrans('cuisine', value) }}</option>
{% endfor %}
<option value='-' query='nwr[!cuisine]' weight='1'>{{ trans('empty value') }}</option>
<option value='*' query='nwr[cuisine]' weight='1'>Any value</option>
# 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"]

20
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 %}

33
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'
Loading…
Cancel
Save