PRO: MVG-API Stationdetails

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

back to adress-search
servingLines:
  • U1: UBAHN to Mangfallplatz
  • 153: BUS to Odeonsplatz U via Hochschule

current time: 20:46:57
departures:
1 Min 20:48 U1 Olympia-Einkaufszentrum Gleis 1
5 Min 20:52 U1 Mangfallplatz Gleis 2
7 Min 20:54 153 Odeonsplatz U via Hochschule
11 Min 20:58 U1 Olympia-Einkaufszentrum Gleis 1
15 Min 21:02 U1 Mangfallplatz Gleis 2
20 Min 21:07 153 Donnersbergerbrücke S
21 Min 21:08 U1 Olympia-Einkaufszentrum Gleis 1
25 Min 21:12 U1 Mangfallplatz Gleis 2
31 Min 21:18 U1 Olympia-Einkaufszentrum Gleis 1
35 Min 21:22 U1 Mangfallplatz Gleis 2
45 Min 21:32 U1 Mangfallplatz Gleis 2
51 Min 21:38 U1 Olympia-Einkaufszentrum Gleis 1

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>