Giter Club home page Giter Club logo

hacklabor-nahverkehrmonitor's Introduction

Abfahrtsmonitor für das Hacklabor

Das Hacklabor ist ein Hackspace im Schweriner Technologiezentrum. Dieses Skript soll die nächsten Abfahrten des ÖPNV an den nächstgelegenen Haltestellen liefern. Unter https://hacklabor.de/standort/ ist es im Einsatz zu sehen.

Datenbasis

Die Daten werden von dem API der Verkehrsgesellschaft Mecklenburg-Vorpommern mbH Schwerin angefragt. Die Funktionsweise wurde auf Basis der iOS App analysiert. Dort ist die gewünschte Funktion implementiert.

UPDATE: Die VMV nutzt das Elektronische Fahrplansystem (EFA).

Funktionsweise des API

In der App werden die folgenden drei Schritte durchgeführt.

  • Ortsinformationen wie Straßenname und Hausnummer anhand der Geokoordinaten abfragen
  • Haltestellen in der Nähe abfragen
  • Abfahrten zu den Haltestellen abfragen

Ortsinfos zum aktuellen Standort

Für unseren Zweck erstmal nicht relevant.

Nächstgelegene Haltestellen

Basierend auf den Geokoordinaten des Standortes werden die nächstgelegenen Haltestellen abgefragt.

Request

http://efa.vmv-mbh.de/companion-vmv/XML_COORD_REQUEST?coord=3660138.493147123:216174.5266245753:NAV3:&coordListOutputFormat=STRING&coordOutputFormat=NAV3&inclFilter=1&type_1=STOP&stateless=1&max=5&radius_1=1000

Die dichtesten Haltestellen für Bus und Straßenbahn sind folgende:

  • 44402071: Technologiezentrum
  • 44402070: Rosenstraße
  • 44402209: Blumenbrink
  • 44402035: Gartenstadt

Die Gartenstadt taucht in der Liste nicht mit auf. Da dort aber Straßenbahnen verkehren, die nicht im/am Blumenbrink halten, wird sie ebenfalls abgefragt.

Diese IDs sind die Werte für den Parameter name_dm in der nächsten Abfrage.

Abfahrten an Haltestellen

Je Haltestelle wird die folgende URL aufgerufen.

Request

http://efa.vmv-mbh.de/companion-vmv/XML_DM_REQUEST?name_dm=<id>&type_dm=any&trITMOTvalue100=10&changeSpeed=normal&exclMOT_0=1&exclMOT_1=1&exclMOT_2=1&mergeDep=1&coordOutputFormat=NAV3&coordListOutputFormat=STRING&useAllStops=1&excludedMeans=checkbox&useRealtime=1&deleteAssignedStops=1&itOptionsActive=1&canChangeMOT=0&mode=direct&ptOptionsActive=1&limit=10&imparedOptionsActive=1&locationServerActive=1&depType=stopEvents&useProxFootSearch=0&maxTimeLoop=2&includeCompleteStopSeq=1

Der Wert für den Knoten tk in der Antwort scheint eine Art ID für die Fahrt zu sein.

Funktionsweise des Skriptes

Für die oben genannten Haltestellen werden die Daten abgefragt. Die Antworten werden bis zu 6 Minuten gecached um nicht unnötig oft auf das API zuzugreifen. Die Abfahrten werden zusammengefasst und nach Zeit sortiert. Das Ergebnis wird als JSON ausgegeben.

hacklabor-nahverkehrmonitor's People

Contributors

michamilz avatar

Stargazers

Murdoc Bates avatar Johannes Filter avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.