Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afimb/gtfslib-python
An open source library in python for reading GTFS files and computing various stats and indicators about Public Transport networks
https://github.com/afimb/gtfslib-python
Last synced: about 2 months ago
JSON representation
An open source library in python for reading GTFS files and computing various stats and indicators about Public Transport networks
- Host: GitHub
- URL: https://github.com/afimb/gtfslib-python
- Owner: afimb
- License: gpl-3.0
- Archived: true
- Created: 2015-12-15T12:24:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-19T19:16:41.000Z (over 5 years ago)
- Last Synced: 2024-05-07T05:22:08.471Z (about 2 months ago)
- Language: Python
- Size: 482 KB
- Stars: 43
- Watchers: 12
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-transit - gtfslib-python - An open source library in python for reading GTFS files and computing various stats and indicators about Public Transport networks. (Uncategorized / Uncategorized)
- awesome-transit - gtfslib-python - An open source library in python for reading GTFS files and computing various stats and indicators about Public Transport networks. (Uncategorized / Uncategorized)
README
# gtfslib-python
An open source library in python for reading GTFS files and computing various stats and indicators about Public Transport networks[![Build Status](https://travis-ci.org/afimb/gtfslib-python.svg)](https://travis-ci.org/afimb/gtfslib-python)
This software is open source ([GPLv3](https://github.com/afimb/gtfslib-python/blob/master/LICENSE)); in particular, there is no warranty.
A more complete documentation can be found [in the wiki](https://github.com/afimb/gtfslib-python/wiki)
-> Pour des explications **en français**, voir [la page FR du wiki](https://github.com/afimb/gtfslib-python/wiki)
## Installation
(Optional) You may want to setup a virtual environment before:
(See https://virtualenv.readthedocs.org/ for more info.)$ virtualenv
$ . /bin/activateDownload and install the lib:
$ git clone [email protected]:afimb/gtfslib-python.git
$ cd gtfslib-python
$ pip install .
$ gtfsdbloader --help## Usage
### Command-line tool
$ gtfsdbloader --help
### API tutorial
```python
from gtfslib.dao import Dao
dao = Dao("db.sqlite")
dao.load_gtfs("mygtfs.zip")
for stop in dao.stops():
print(stop.stop_name)
for route in dao.routes(fltr=Route.route_type == Route.TYPE_BUS):
print("%s: %d trips" % (route.route_long_name, len(route.trips)))
```For more information [see here](https://github.com/afimb/gtfslib-python/wiki/API-usage-tutorial).
## Data model
The internal model used, GTFS', is close to GTFS but simplified / normalized / expanded for ease of use.
The main differences are:
* A calendar is a simple list of calendar dates (there is no date range, day of the week and positive/negative exceptions anymore).
* All optional fields with a default value are set (for example, pickup/dropoff types)
* Missing stop times are correctly interpolated, and marked with a flag.
* Shape distances are converted to meters and computed if missing.
* All frequencies are expanded to normal trips, and marked with a flag (TODO).
* ...For the detail and more information [see here](https://github.com/afimb/gtfslib-python/wiki/Internal-model---GTFS').