- Python 100%
Taival
Taival is an openstreetmap public transport mapping tool and report generator / validator. It downloads data from openstreetmap and a transit provider (currently only Helsinki Region Transport, HSL) compares them and writes out useful things.
Reports generated by taival are uploaded occasionally to https://wiki.openstreetmap.org/wiki/Finland:Joukkoliikenne/HSL#Vertailu
Installation
Taival is a Python 3 program and taival.py can be executed directly from the repository. Dependencies can be installed with pip:
pip install overpy requests gpxpy pykdtree
Or apt (overpy is too old in Debian, get it with pip):
apt install python3-requests python3-gpxpy python3-pykdtree
Usage
$ ./taival.py help
usage: taival.py [-h] [--version]
{gpx,osmxml,collect,routes,stops,stations,citybikes,help} ...
positional arguments:
{gpx,osmxml,collect,routes,stops,stations,citybikes,help}
sub-command -h for help
gpx Output gpx files for given line.
osmxml Output OSM XML snippets with stops and some tags for a given
line.
collect Collect info from APIs to a file for stops, stations, or routes
for mode
routes Output a mediawiki report on routes from previously collected
data in pickle format.
stops Output a mediawiki report on stops from previously collected data
in pickle format, possibly limited by mode and/or city
stations Output a mediawiki report on stations from previously collected
data in pickle format, possibly limited by mode
citybikes Output a mediawiki report on citybike stations from previously
collected data in pickle format
help Show help for a subcommand
optional arguments:
-h, --help show this help message and exit
--version, -v show program's version number and exit
Taival has subcommands for various use cases.
GPX track from a public transport route
$ taival gpx tram route 1
$ ls 1*.gpx
1_osm_0.gpx
1_osm_1.gpx
1_HSL_HSL:.&checktime(1001,0,02,':')_0.gpx
1_HSL_HSL:.&checktime(1001,0,01,':')_0.gpx
1_HSL_HSL:.&checktime(1001,0,03,':')_0.gpx
1_HSL_HSL:.&checktime(1001,1,03,':')_1.gpx
1_HSL_HSL:.&checktime(1001,1,02,':')_1.gpx
1_HSL_HSL:.&checktime(1001,1,05,':')_1.gpx
1_HSL_HSL:.&checktime(1001,1,04,':')_1.gpx
1_HSL_HSL:.&checktime(1001,1,01,':')_1.gpx
OSM-XML representation of a public transport route
$ taival osmxml 1 tram
$ ls 1*.osm
1_HSL_HSL:.&checktime(1001,0,01,':').osm
1_HSL_HSL:.&checktime(1001,0,02,':').osm
1_HSL_HSL:.&checktime(1001,0,03,':').osm
1_HSL_HSL:.&checktime(1001,1,01,':').osm
1_HSL_HSL:.&checktime(1001,1,02,':').osm
1_HSL_HSL:.&checktime(1001,1,03,':').osm
1_HSL_HSL:.&checktime(1001,1,04,':').osm
1_HSL_HSL:.&checktime(1001,1,05,':').osm
Report / validate OSM data against provider data
First, collect data from provider to pickle files (warning, this can take a really long time, due to many Overpass queries).
$ taival collect ferry
$ taival collect subway
$ taival collect train
$ taival collect tram
$ taival collect bus
$ taival collect stops
$ taival collect stations
$ taival collect citybikes
$ ls *.pickle
HSL_bus.pickle
HSL_citybikes.pickle
HSL_ferry.pickle
HSL_stations.pickle
HSL_stops.pickle
HSL_subway.pickle
HSL_train.pickle
HSL_tram.pickle
Generate some reports in Mediawiki syntax from data files
$ taival routes HSL_tram.pickle > HSL_tram.txt
$ taival stops tram > HSL_stops_tram.txt
$ taival stops bus Helsinki > HSL_stops_bus_Helsinki.txt
$ taival stations > HSL_stations.txt
$ taival citybikes > HSL_citybikes.txt