PRO: MVG-API Stationdetails

This page shows deatails for a MVG-Station in munich and the next departing vehicles:

back to adress-search blutenburg
servingLines:
  • 56: BUS to Fürstenried West U
  • 143: BUS to Freiham Möbel Höffner

current time: 03:19:29
departures:
38 Min 03:58 56 Fürstenried West U
58 Min 04:18 56 Fürstenried West U
1 Hrs, 18 Min 04:38 56 Fürstenried West U
1 Hrs, 28 Min 04:48 143 Neuaubing West
1 Hrs, 34 Min 04:54 56 Fürstenried West U
1 Hrs, 44 Min 05:04 56 Fürstenried West U
1 Hrs, 51 Min 05:11 143 Freiham Möbel Höffner
1 Hrs, 54 Min 05:14 56 Fürstenried West U
2 Hrs, 4 Min 05:24 56 Fürstenried West U
2 Hrs, 9 Min 05:29 56 Fürstenried West U
2 Hrs, 11 Min 05:31 143 Freiham Möbel Höffner
2 Hrs, 14 Min 05:34 56 Fürstenried West U

Create a new JCI-template:

  • urlparam4twig: stationid#su
  • URL:
{% set su = "de:09162:180" %}
{% if urlparam.stationid %}{% set su = urlparam.stationid | trim | url_encode %}
{% endif %}
https://www.mvg.de/api/fahrinfo/departure/{{su}}?footway=4

twig-template:

<a href="/pro-mvg-api-munchner-verkehrsverbund-adresssuche/?su={{urlparam.su | url_encode}}">back to adress-search {{urlparam.su | e | stripslashes }}</a><hr>

servingLines:<br>
<ul>
{% for item in servingLines %}
<li>
    {{item.lineNumber}}: {{item.product}} to {{item.destination}}
    </li>
{% endfor %}
</ul>
<hr>
{% set hour = 3600 %}
{% set currenttimestamp = ("now"|date("U")) %}
current time: {{ (currenttimestamp+hour) |date("H:i:s") }}
<hr>
departures:<br>
<table border=1>
{% for i in departures | slice(0, 12) %}
       {% set deltasec = (i.departureTime/1000 - currenttimestamp) %}
    <tr><td>
        {% set mindist = (deltasec/60) |round(0, "floor") %}
        {% if mindist>60 %}
            {% set hrs = (deltasec/60/60) | round(0, "floor") %}
           {{hrs}} Hrs, {{mindist-60*hrs}} Min
        {% else %}
            {{mindist}} Min
        {% endif %}        
        
     </td><td>
       {{(i.departureTime/1000+hour) | date("H:i") }}
     </td><td>
       {{i.label}} 
    </td><td>
        {{i.destination}}
     </td><td>
        {{i.platform}}
   </td></tr>
{% endfor %}
</table>