From dcb7010a7107bdd7cd72c6c6f2bd7f02238d1320 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Sun, 5 Aug 2018 08:23:04 +0200
Subject: [PATCH] pt: show only stops with min. 1 route

---
 pt.json | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pt.json b/pt.json
index 6dd8884..2ebef1b 100644
--- a/pt.json
+++ b/pt.json
@@ -74,6 +74,7 @@
         "pre": [
             "{% set stopName = '' %}",
             "{% set isStop = false %}",
+            "{% set stopCount = 0 %}",
             "{% if tags.highway == 'bus_stop' or tags.amenity == 'bus_station' or tags.amenity == 'ferry_terminal' or tags.railway == 'tram_stop' or tags.railway == 'halt' or tags.railway == 'station' or tags.aerialway == 'station' or tags.public_transport == 'stop_position' %}{% set isStop = true %}{% endif %}",
             "{% set isWay = false %}",
             "{% set aRoute = null %}",
@@ -84,6 +85,7 @@
             "  {% else %}",
             "    {% if master.role|matches('^(|.*stop)$') and isStop %}",
             "      {% set isStop = true %}",
+            "      {% set stopCount = stopCount + 1 %}",
             "    {% elseif master.role|matches('^(|forward|backward)$') and type == 'way' %}",
             "      {% set isWay = true %}",
             "    {% endif %}",
@@ -100,7 +102,7 @@
         ],
         "listStopsMarkerSymbol": "{{ markerCircle({ width: 5, color: color, fillOpacity: '1', radius: 3 })|raw }}",
         "listStopsMarkerSign": "",
-        "styles": "{% if isStop %}stop{% elseif isWay %}way{% else %}{% endif %}",
+        "styles": "{% if isStop and stopCount > 0 %}stop{% elseif isWay %}way{% else %}{% endif %}",
         "style:way": {
             "color": [
                 "{{ color|default('#ff0000') }}"
@@ -136,7 +138,7 @@
             "</ul>"
         ],
         "listRoutesExclude": "true",
-        "listStopsExclude": "{{ not isStop }}"
+        "listStopsExclude": "{{ not isStop or stopCount == 0 }}"
     },
     "info": [
         "<table>",