From 0cff620d325cc33392c1eb8149514bac070f9c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Wed, 25 Oct 2017 20:57:04 +0200 Subject: [PATCH] unfinished --- culture.json | 25 +++++++++++++------------ railway-electrification.json | 8 +++++--- railway-infrastructure.json | 6 ++++-- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/culture.json b/culture.json index 95c723d0..1b4b79c0 100644 --- a/culture.json +++ b/culture.json @@ -25,18 +25,19 @@ "feature": { "pre": "{% if tags.amenity in [ 'arts_centre', 'cinema', 'community_centre', 'fountain', 'studio', 'theatre' ] %}\n{% set key = 'amenity' %}\n{% set value = tags.amenity %}\n{% elseif tags.tourism %}\n{% set key = 'tourism' %}\n{% set value = tags.tourism %}\n{% endif %}", "description": "{{ tagTrans(key, value) }}", - "markerSign": "{{ const[value] }}" + "markerSign": "{{ attribute(const, key ~ '=' ~ value) }}" }, "const": { - "arts_centre": "🎨", - "cinema": "🎦", - "community_centre": "", - "fountain": "⛲", - "studio": "", - "theatre": "🎭", - "artwork": "🎨 ", - "gallery": "🖼", - "museum": "🏛 ", - "theme_park": "" - } + "amenity=arts_centre": "🎨", + "amenity=cinema": "🎦", + "amenity=community_centre": "", + "amenity=fountain": "⛲", + "amenity=studio": "", + "amenity=theatre": "🎭", + "tourism=artwork": "🎨 ", + "tourism=gallery": "🖼", + "tourism=museum": "🏛 ", + "tourism=theme_park": "" + }, + "info": "\n{% for value, sign in const %}\n \n \n \n \n{% endfor %}\n
{{ markerCircle({})|raw }}
{{ sign }}
{{ tagTrans(value|split('=')[0], value|split('=')[1]) }}
" } diff --git a/railway-electrification.json b/railway-electrification.json index 77efc257..9caee08a 100644 --- a/railway-electrification.json +++ b/railway-electrification.json @@ -9,7 +9,7 @@ "14": "way[railway][railway!~'^(platform|abandoned|disused|station|proposed)$'];" }, "feature": { - "pre": "{% if tags.electrified and tags.electrified != 'no' %}\n {% if tags.voltage < 5000 %}\n {% set color = colorInterpolate([ 'green', 'red' ], tags.voltage / 1000) %}\n {% else %}\n {% set color = colorInterpolate([ 'red', 'blue' ], (tags.voltage - 1000) / 24000) %}\n {% endif %}\n{% else %}\n {% set color='black' %}\n{%endif %}\n\n{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}\n {% set weight=2 %}\n {% else %}\n {% if tags.railway == 'rail' %}\n {% if tags.usage == 'main' or tags.usage == 'branch' %}\n {% set weight=3 %}\n {% else %}\n {% set weight=2.5 %}\n {% endif %}\n {% else %}\n {% set weight=2 %}\n {% endif %}\n{% endif %}", + "pre": "{% if tags.electrified and tags.electrified != 'no' %}\n {% if tags.voltage < 1000 %}\n {% set color = colorInterpolate([ '#00ff00', 'blue' ], tags.voltage / 1000) %}\n {% else %}\n {% set color = colorInterpolate([ 'blue', 'red' ], (tags.voltage - 1000) / 24000) %}\n {% endif %}\n{% else %}\n {% set color='black' %}\n{%endif %}\n\n{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}\n {% set weight=2 %}\n {% else %}\n {% if tags.railway == 'rail' %}\n {% if tags.usage == 'main' or tags.usage == 'branch' %}\n {% set weight=3 %}\n {% else %}\n {% set weight=2.5 %}\n {% endif %}\n {% else %}\n {% set weight=2 %}\n {% endif %}\n{% endif %}", "style:casing": { "weight": "{{ weight + 2 }}", "color": "{{ color }}", @@ -36,6 +36,8 @@ "body": "{{ tagTrans('railway', tags.railway) }}
\n{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %}\n{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}
{% endif %}\n{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}
{% endif %}\n{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}
\n{% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %}\n", "description": "{{ tagTrans('railway', tags.railway) }} -\n\n{% if tags.electrified == 'no' %}\n {{ trans('not electrified') }}\n{% elseif tags.electrified %}\n {{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz\n{% endif %}", "priority": "{% if tags.railway == 'station' %}0{% elseif tags.railway in [ 'halt', 'tram_stop' ] %}1{% else %}5{% endif %}", - "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}" - } + "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}", + "listMarkerSymbol": "{{ markerLine({ 'weight': 3, 'color': color })|raw }}" + }, + "info": "\n{% for i in range(0, 1000, 200) %}\n {% set color = colorInterpolate([ '#00ff00', 'blue' ], i / 1000) %}\n \n \n \n \n{% endfor %}\n\n{% for i in range(3000, 25000, 2000) %}\n {% set color = colorInterpolate([ 'blue', 'red' ], (i - 1000) / 24000) %}\n \n \n \n \n{% endfor %}\n
{{ markerLine({ 'weight': 3, 'color': color })|raw }}{{ i }}V
{{ markerLine({ 'weight': 3, 'color': color })|raw }}{{ i }}V
" } diff --git a/railway-infrastructure.json b/railway-infrastructure.json index 3abec53b..eedc6b88 100644 --- a/railway-infrastructure.json +++ b/railway-infrastructure.json @@ -30,6 +30,8 @@ "body": "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %}\n{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}
{% endif %}\n{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}
{% endif %}\n{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}
\n{% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %}\n", "description": "{{ tagTrans('railway', tags.railway) }}", "priority": "{% if tags.railway == 'station' %}0{% elseif tags.railway in [ 'halt', 'tram_stop' ] %}1{% else %}5{% endif %}", - "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}" - } + "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}", + "listMarkerSymbol": "{% if tags.railway == 'station' %}\narea\n{% else %}\nline\n{% endif %}" + }, + "info": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n{{ console_log(map) }}\n{% if map.zoom >= 14 %}\n \n \n \n \n{% endif %}\n
{{ markerLine(evaluate({ \"railway\": \"rail\", \"usage\": \"main\" }))|raw }}{{ tagTrans('railway', 'rail') }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', 'main') }}
{{ markerLine(evaluate({ \"railway\": \"rail\" }))|raw }}{{ tagTrans('railway', 'rail') }}
{{ markerLine(evaluate({ \"railway\": \"narrow_gauge\" }))|raw }}{{ tagTrans('railway', 'narrow_gauge') }}
{{ markerLine(evaluate({ \"railway\": \"light_rail\" }))|raw }}{{ tagTrans('railway', 'light_rail') }}
{{ markerLine(evaluate({ \"railway\": \"subway\" }))|raw }}{{ tagTrans('railway', 'subway') }}
{{ markerLine(evaluate({ \"railway\": \"tram\" }))|raw }}{{ tagTrans('railway', 'tram') }}
" }