From 87e7a40e9654242262b3e58793d8c2e8e61b0720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 5 Oct 2017 23:01:52 +0200 Subject: [PATCH] Car Maxspeed: new category --- car_maxspeed.json | 20 ++++++++++++++++++++ index.json | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 car_maxspeed.json diff --git a/car_maxspeed.json b/car_maxspeed.json new file mode 100644 index 00000000..08ba5864 --- /dev/null +++ b/car_maxspeed.json @@ -0,0 +1,20 @@ +{ + "type": "overpass", + "name": { + "en": "Maxspeed" + }, + "query": { + "11": "way[highway~\"^(motorway|trunk)$\"];", + "15": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|residential|unclassified)$\"];", + "13": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|tertiary)$\"];", + "17": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|residential|unclassified|service|living_street|pedestrian|track|road)$\"];" + }, + "feature": { + "pre": "{% if tags.maxspeed is not defined %}\n{% set maxspeedKmh = null %}\n{% set maxspeed = null %}\n{% set unit = null %}\n{% else %}\n\n{% if tags.maxspeed|matches(\"^[0-9]+$\") %}\n{% set maxspeedKmh = tags.maxspeed %}\n{% set maxspeed = tags.maxspeed %}\n{% set unit = \"km/h\" %}\n{% endif %}\n\n\n{% set m = tags.maxspeed|matches(\"(^[0-9]+) mph$\") %}\n{% if m %}\n{% set maxspeedKmh = m[1] * 1.60934 %}\n{% set maxspeed = tags.maxspeed %}\n{% set unit = \"mph\" %}\n{% endif %}\n\n{% endif %}\n\n{% if not maxspeedKmh %}\n{% set color = \"#404040\" %}\n{% else %}\n{% set color = colorInterpolate([ 'green', 'orange', 'red' ], maxspeedKmh / 150) %}\n{% endif %}", + "description": "{% if maxspeed %}\n{{ maxspeed }} {{ unit }}\n{% else %}\n{{ trans('unknown') }}\n{% endif %}", + "style": { + "color": "{{ color }}" + }, + "markerSign": null + } +} diff --git a/index.json b/index.json index b3db8b27..281cb616 100644 --- a/index.json +++ b/index.json @@ -196,6 +196,9 @@ "subCategories": [ { "id": "car_amenities" + }, + { + "id": "car_maxspeed" } ] }