From aea862cb407c0f0deb430de3d36dc7cb2c3074d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at> Date: Tue, 5 Jun 2018 22:19:18 +0200 Subject: [PATCH] Buildings: height --- buildings-height.json | 104 ++++++++++++++++++++++++++++++++++++++++++ buildings.json | 3 ++ 2 files changed, 107 insertions(+) create mode 100644 buildings-height.json diff --git a/buildings-height.json b/buildings-height.json new file mode 100644 index 0000000..84c21af --- /dev/null +++ b/buildings-height.json @@ -0,0 +1,104 @@ +{ + "type": "overpass", + "name": { + "de": "Gebäudehöhen", + "en": "Building height" + }, + "query": { + "16": [ + "(", + " way[building];", + " relation[building];", + ")" + ] + }, + "feature": { + "pre": [ + "{% if tags.height %}", + "{% set approxHeight = tags.height %}", + "{% elseif attribute(tags, 'building:levels') %}", + "{% set approxHeight = attribute(tags, 'building:levels') * 3.5 %}", + "{% endif %}", + "", + "{% if approxHeight <= 50 %}", + "{% set color = colorInterpolate(['green', 'red'], approxHeight / 50) %}", + "{% elseif approxHeight %}", + "{% set color = colorInterpolate(['red', 'yellow'], (approxHeight - 50) / 250) %} ", + "{% else %}", + "{% set color = '#7f7f7f' %}", + "{% endif %}" + ], + "description": [ + "{% if tags.height %}", + "{{ tags.height }}m", + "{% endif %}", + "", + "{% if attribute(tags, 'building:levels') %}", + "{{ attribute(tags, 'building:levels') }} {{ keyTrans('building:levels') }}", + "{% endif %}" + ], + "markerSymbol": null, + "listMarkerSymbol": "{{ markerCircle({fillColor: color})|raw }}", + "priority": "{{ (approxHeight|default(0)) * -1 }}", + "style": { + "width": "1", + "color": "#000000", + "fillColor": "{{ color }}", + "fillOpacity": "1" + } + }, + "info": [ + "<div style='display: inline-block'>", + "{{ tagTrans('height') }}", + "<table>", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': '#7f7f7f' })|raw }}</td>", + " <td colspan>{{ trans('unknown') }}</td>", + " </tr>", + "{% for i in range(0, 50, 10) %}", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': colorInterpolate(['green', 'red'], i / 50) })|raw }}</td>", + " <td>{{ i }}m</td>", + " </tr>", + "{% endfor %}", + "{% for i in range(100, 250, 50) %}", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': colorInterpolate(['red', 'yellow'], (i - 50) / 250) })|raw }}</td>", + " <td>{{ i }}m</td>", + " </tr>", + "{% endfor %}", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': 'yellow' })|raw }}</td>", + " <td>≥300m</td>", + " </tr>", + "</table>", + "</div>", + "", + "<div style='display: inline-block'>", + "{{ tagTrans('building:levels') }}", + "<table>", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': '#7f7f7f' })|raw }}</td>", + " <td colspan>{{ trans('unknown') }}</td>", + " </tr>", + "{% for i in range(0, 12, 3) %}", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': colorInterpolate(['green', 'red'], (i * 3.5) / 50) })|raw }}</td>", + " <td>{{ i }}</td>", + " </tr>", + "{% endfor %}", + "{% for i in range(15, 84, 15) %}", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': colorInterpolate(['red', 'yellow'], (i * 3.5 - 50) / 250) })|raw }}</td>", + " <td>{{ i }}</td>", + " </tr>", + "{% endfor %}", + " <tr>", + " <td>{{ markerCircle({ 'fillColor': 'yellow' })|raw }}</td>", + " <td>≥85</td>", + " </tr>", + "</table>", + "", + "</div>" + ] +} diff --git a/buildings.json b/buildings.json index 94bb4a9..0d77826 100644 --- a/buildings.json +++ b/buildings.json @@ -9,6 +9,9 @@ "subCategories": [ { "id": "buildings-figure-ground" + }, + { + "id": "buildings-height" } ] }