generate-nice-timetables
The project contains a Jupyter Notebook to get the transit schedule between a given origin-destination pair on a given date from the Google Directions API.
Requirements
In addition to installing the packages from REQUIREMENTS.txt
, you should also get a Google API key for a project that has access both to the Directions and Geocoding API. We will use these to get the actual schedules and to determine which municipality the stops are located in. Visit this page and read the documentation to get started.
Usage
You should first set your Google API key in the envirorment (for example, in Terminal on a Mac, you could do this by export GOOGLE_API_KEY="MY_API_KEY"
) before launching the notebook server. The notebook is commented and self contained so you can just run the whole thing.
The notebook will generate a timetable like the one shown below and save it in timetable.html
.
The meaning of the specific data fields should be easy to understand; in case of unclarity they can be inferred from the code.
Contributing
Feel free to submit pull requests; help would be especially appreciated in turning this into a proper Python package and command line tool.
Roadmap
Ideally, I would like to create a CLI tool that is submitted to PIP and generates the timetable in one line. For example, it could be used as
transit_timetable \
-o "Budapest, Hungary" \
-d "Balatonhenye, Hungary" \
-t 2018-10-20 \
-k GOOGLE_API_KEY \
-O timetable.html
See also
This post on my blog describes the project with a bit more context.