From 1950bc8de45061168744bbf8cc7aa7a892bac6bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Thu, 12 Oct 2017 06:46:16 +0200
Subject: [PATCH] Railway: restructure; new electrification sub category

---
 index.json                                  | 24 ++++++++++++++-
 railway-electrification.json                | 33 +++++++++++++++++++++
 railway.json => railway-infrastructure.json | 13 ++------
 3 files changed, 58 insertions(+), 12 deletions(-)
 create mode 100644 railway-electrification.json
 rename railway.json => railway-infrastructure.json (91%)

diff --git a/index.json b/index.json
index 281cb61..b17c2b8 100644
--- a/index.json
+++ b/index.json
@@ -238,7 +238,29 @@
                     "id": "power"
                 },
                 {
-                    "id": "railway"
+                    "id": "railway",
+                    "type": "index",
+                    "name": {
+                        "ast": "Ferrocarril",
+                        "cs": "Železnice",
+                        "de": "Eisenbahn",
+                        "en": "Railway",
+                        "et": "Raudtee",
+                        "fr": "Chemins de fer",
+                        "hu": "Vasút",
+                        "it": "Ferrovie",
+                        "ja": "鉄道",
+                        "nl": "Spoorwegen",
+                        "ru": "Железные дороги"
+                    },
+                    "subCategories": [
+                        {
+                            "id": "railway-infrastructure"
+                        },
+                        {
+                            "id": "railway-electrification"
+                        }
+                    ]
                 },
                 {
                     "id": "resources"
diff --git a/railway-electrification.json b/railway-electrification.json
new file mode 100644
index 0000000..9f5cfca
--- /dev/null
+++ b/railway-electrification.json
@@ -0,0 +1,33 @@
+{
+    "type": "overpass",
+    "name": {
+        "de": "Eisenbahn Elektrifizierung",
+        "en": "Railway electrification"
+    },
+    "query": {
+        "11": "way[railway=rail][usage~'^(main|branch)$'];",
+        "14": "way[railway];"
+    },
+    "feature": {
+        "style:casing": {
+            "weight": "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}5{% else %}{% if tags.railway == 'rail' %}{% if tags.usage == 'main' or tags.usage == 'branch' %}7{% else %}6{% endif %}{% elseif tags.railway == 'platform' %}5{% else %}6{% endif %}{% endif %}",
+            "color": "{% if tags.railway == 'rail' or tags.railway == 'narrow_gauge' or tags.railway == 'disused' %}{% if tags.usage == 'main' %}#ff8100{% elseif tags.usage == 'branch' %}#daca00{% else %}#000000{% endif %}{% elseif tags.railway == 'subway' %}#0000ff{% elseif tags.railway == 'tram' %}#ff00ff{% elseif tags.railway == 'platform' %}#3f3f3f{% else %}#000000{% endif %}",
+            "dashArray": "2,4",
+            "lineCap": "butt"
+        },
+        "style": {
+            "color": "{% if tags.electrified and tags.electrified != 'no' %}red{% else %}black{%endif %}",
+            "weight": "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}1{% else %}{% if tags.railway == 'rail' %}{% if tags.usage == 'main' or tags.usage == 'branch' %}3{% else %}2{% endif %}{% elseif tags.railway == 'platform' %}1{% else %}2{% endif %}{% endif %}",
+            "dashArray": "{% if tags.railway == 'rail' %}{% elseif tags.railway == 'disused' %}1,5{% elseif tags.railway == 'abandoned' %}1,7{% endif %}",
+            "fillColor": "{% if tags.railway == 'platform' %}#3f3f3f{% endif %}",
+            "fill": "{% if tags.railway == 'platform' %}1{% else %}{% endif %}",
+            "opacity": "1"
+        },
+        "styles": "{% if tags.railway == 'narrow_gauge' %}default,casing{% else %}default{% endif %}",
+        "markerSign": null,
+        "body": "{{ tagTrans('railway', tags.railway) }}<br/>\n{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}\n{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}\n{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}<br/>{% endif %}\n{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}<br/>\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')) }}<br/>{% 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')) }}"
+    }
+}
diff --git a/railway.json b/railway-infrastructure.json
similarity index 91%
rename from railway.json
rename to railway-infrastructure.json
index 158cd7b..082bfe8 100644
--- a/railway.json
+++ b/railway-infrastructure.json
@@ -1,16 +1,7 @@
 {
     "name": {
-        "ast": "Ferrocarril",
-        "cs": "Železnice",
-        "de": "Eisenbahn",
-        "en": "Railway",
-        "et": "Raudtee",
-        "fr": "Chemins de fer",
-        "hu": "Vasút",
-        "it": "Ferrovie",
-        "ja": "鉄道",
-        "nl": "Spoorwegen",
-        "ru": "Железные дороги"
+        "en": "Railway infrastructure",
+        "de": "Eisenbahn Infrastruktur"
     },
     "type": "overpass",
     "query": {