Coder Social home page Coder Social logo

maehw / oebb-train-localizer-speedometer Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.53 MB

Extract, store and present the current GPS position and train speed (in km/h) of ÖBB railnet trains

License: GNU General Public License v3.0

Python 92.17% CSS 7.83%
flask gps-location gps-tracker localizer oebb position public-transport python3 speedometer trains

oebb-train-localizer-speedometer's Introduction

README

The Python script extract.py extracts the current GPS position and train speed (in km/h) from the live map publicly accessible in ÖBB railnet trains, hence the name of the repository. It works when being connected to the train's WiFi but independent of your device's position sensor. The data is parsed periodically (every 2 seconds) and stored to a CSV file for further analysis.

ICE Portal Karte

⬇️

CSV snippet

You can also run the second Python script serve.py using Flask in addition. It will serve the extracted data on your own website from the latest logged CSV data. Please note that it must be started using flask --app serve run (python serve.py would immediately finish execution and return).

$ flask --app serve run
 * Serving Flask app 'serve'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
...

Use your favorite web browser and go to the URL listed in the console output: http://127.0.0.1:5000

Flask server

Optionally, you can visualize the recorded tracks using Python script visualize.py: it will create an HTML map file (travel_map.html) using OpenStreetMap to visualize every journey CSV file as polyline:

Map visualization (red)

By (current) default, you can even get a very colorful map that also dies visualize train speed:

Map visualization (color)

How does it work?

This script automatically sends two HTTP GET requests to the API - one for speed and one for location. The source for the train speed seems to be independent of GPS - as speed still works in tunnels whereas location (obviously) doesn't.

Prerequisites

  • Working Python3 environment with the requests module installed.
  • Be on an ÖBB train (tested on RJX so far).
  • Manually connect to WiFi "OEBB".
  • Python module folium for visualization of track on map (optional).

Future ideas

You could also ...

oebb-train-localizer-speedometer's People

Contributors

maehw 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.