Python package for analyzing public transport timetables


Keywords
transit, routinggtfs, public, transport, analysis, visualization, gtfs, python, routing, sqlite
License
MIT
Install
pip install gtfspy==0.0.4

Documentation

gtfspy

Gtfspy-master Travis CI build passing PyPI badge

gtfspy is a Python package for analyzing public transport timetable data provided in the General Transit Feed Specification, GTFS, -format.

Core features:

  • Import one or multiple GTFS feeds into one SQLite database for efficient querying of the data.
  • Augment the sqlite with real walking distances between PT stops using Open Street Map (OSM) data.
  • Compute simple statistics for the public transport networks such as number of stops, routes, network length.
  • Filter databases spatially and temporally to match your area and time region of interst.
  • Perform accessibility analyses using a routing/profiling engine
    • Adapted from the Connection Scan Algorithm (CSA).
    • Compute all Pareto-optimal journey alternatives between an origin-destination pair, and summarize connectivity with measures on travel time and number of transfers.
  • Produce data extracts in various formats (network edge lists, geojson).

Prerequisites

  • Python 3.5
  • Supported platforms: Linux + OSX (Windows is currently not supported, please creat an issue in Github if you would be interested in running gtfspy on Windows)
  • Optional: git is used for development.

Install

pip install gtfspy

Development quickstart

Use this if you want to be able to edit gtfspy's source code.

git clone git@github.com:CxAalto/gtfspy.git
cd gtfspy/
pip install -r requirements.txt # install any requirements
nosetests . # run tests

Remember to also add the gtfspy directory to your PYTHONPATH environment variable.

Examples

Contributing

We welcome contributions as GitHub pull requests. In your pull request, please also add yourself as a contributor in the list below.

Versioning

This library is not yet stabilised, and new features are being developed. Thus code organization and interfaces may change at a fast pace. More precise versioning scheme will be decided upon later.

Authors

Package maintainers

Other contributors

  • Manuel Rios (marz7002)

  • Nils Haglund

  • You?

Licensing

Code

This source code of this project licensed under the MIT License - see the LICENSE.txt file for details.

Example data

The OpenStreetMap data (.osm.pbf file(s) under examples/data) is licenced under the Open Data Commons Open Database License (ODbL) by the OpenStreetMap Foundation (OSMF).

The GTFS data used for the examples is provided by the City of Kuopio (Finland), and have been downloaded from http://bussit.kuopio.fi/gtfs/gtfs.zip [data licensed under CC-BY 4.0].

Usage for scientific purposes

If you use this Python package for scientific purposes, please cite our paper

Rainer Kujala, Christoffer Weckström, Miloš N. Mladenović, Jari Saramäki, Travel times and transfers in public transport: Comprehensive accessibility analysis based on Pareto-optimal journeys, In Computers, Environment and Urban Systems, Volume 67, 2018, Pages 41-54, ISSN 0198-9715, https://doi.org/10.1016/j.compenvurbsys.2017.08.012.

Acknowledgments

  • The development of this Python package has benefited from the support by Academy of Finland through the DeCoNet project.
  • For running the Java routing, we use the Graphhopper routing library.

Bugs

If you have any problems using gtfspy please create an issue in GitHub.

Other questions on

If you have any questions regarding gtfspy, feel free to send the package maintainers (see above) an e-mail!

See also

Code for a research project using gtfspy

Web-visualization tool utilizing gtfspy (gtfspy-webviz)