2
0
Fork
You've already forked taival
0
Generates reports comparing Openstreetmap public transport routes against transit provider data (currently only digitransit.fi)
  • Python 100%
Teemu Ikonen 6775ba74ec osm: Add light_rail tags to tram stationtags
That is, consider light_rail stations as tram stations.
2026年06月15日 17:46:43 +03:00
data/HSL Update HSL citybike data 2023年08月21日 11:53:05 +03:00
doc/presentations/HSL_mapathon-2021年05月16日 Add presentation materials from HSL mapathon 2021年05月31日 11:33:45 +03:00
.editorconfig Add .editorconfig file 2024年08月05日 14:06:37 +03:00
COPYING Add license and copyright notices 2021年05月18日 14:34:03 +03:00
digiroad.py digiroad.py: flake8 2022年05月23日 10:08:56 +03:00
digitransit.py digitransit: Skip stops without a 'vehicleMode', log a warning 2025年10月13日 16:50:57 +03:00
hsl.py hsl: Add synonyms 2026年02月17日 17:37:13 +02:00
mediawiki.py mediawiki: Add empty line after route title in route table details 2026年04月30日 20:03:58 +03:00
osm.py osm: Add light_rail tags to tram stationtags 2026年06月15日 17:46:43 +03:00
README.md Fix README.md 2021年07月05日 14:34:07 +03:00
routematching.py mediawiki,routematching: Improve stopcount matching 2025年11月24日 12:36:37 +02:00
setup.cfg setup.cfg: Add mypy section with ignore_missing_imports = True 2024年12月09日 10:47:43 +02:00
taival.py taival: Log more with level INFO 2026年04月29日 10:43:56 +03:00
util.py Refactor test_tag(), move get_multivalue_tag() to util 2024年05月06日 10:19:02 +03:00

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