8000 GitHub - Metalab/oeffimonitor at v0.1.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Displays an info screen with the next Wiener Linien public transport connections nearby.

License

Notifications You must be signed in to change notification settings

Metalab/oeffimonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Öffimonitor

Displays an info screen with the next Wiener Linien public transport connections nearby. It was developed and is currently in use at Metalab.

It includes a small server written in Node.js that pulls the needed data from the Wiener Linien API, caches it and serves it together with an HTML5 frontend. At Metalab, all of this runs on a Raspberry Pi, which also displays the frontend on a spare monitor (check out util for reproduction).

Screenshot of Öffimonitor running at Metalab

Usage

  1. Run npm install to fetch dependencies.
  2. Move server/settings.example.js to server/settings.js and
  3. Add your API key (mandatory, get one here).
  4. Most likely you will also want to change the api_ids to the RBL numbers that correspond to the stations you want to include (find them here) and change the location_coordinate to the location of your Öffimonitor.
  5. Change additional settings (optional).
  6. Run npm start
  7. Open Öffimonitor in a browser of your choice.

API

Besides the HTML frontend you can find a JSON API at /api. It returns a status message, an array of departures and an array of warnings, which include all traffic infos of the type stoerunglang from the Wiener Linien API.

Example response

{
  "status": "ok",                       // 'ok' or 'error'
  "departures":[{
    "stop": "Landesgerichtsstraße",
    "coordinates": [16.3568570699034,48.2145510683941],
    "line": "43",
    "type": "ptTram",
    "towards": "Neuwaldegg",
    "barrierFree": true,
    "time": "2017-02-14T18:54:14.000Z", // calculated most accurate departure time
    "timePlanned": "2017-02-14T19:52:00.000+0100",
    "timeReal": "2017-02-14T19:54:14.000+0100",
    "countdown": 6,
    "walkDuration": 197.9,              // walking duration to stop in seconds
    "walkStatus":"soon"                 // 'too late', 'hurry' or 'soon'
  }],
  "warnings": [{
    "title": "43 : Fremder Verkehrsunfall",
    "description": "Nach einer Fahrtbehinderung kommt es auf der Linie 43 zu unterschiedlichen Intervallen."
  }]
}

All values without comments are directly taken from the Wiener Linien API. Attention! timeReal does not exist in case there is no real time information available and even timePlanned might be undefined if the departure time is written into the towards string (e.g. 'KARLSPLATZ NÄCHSTER ZUG 9 MIN'). In case you need a returned timestamp, rely on time, which always contains the most accurate departure time available.

Example error response

{
  "status": "error",
  "error": "API request failed"
}

License

This project is licensed under AGPL-3. It includes several external assets in the folder site/assets, which are licensed under Creative Commons Namensnennung 3.0 Österreich by Stadt Wien – Wiener Linien (all SVG files) as well as the Roboto font by Google licensed under Apache 2.0 (all TTF files).

For calculating the walking duration to the stop, Öffimonitor by default queries the OSRM Demo Server and caches these results for the current runtime execution. By using the OSRM Demo Server you agree to this API usage policy. The corresponding database is licensed under ODbL by OSRM. You can change the server address to any other OSRM instance in server/settings.js.

Happy hacking!

0