Welcome to Transit + OSMnx’s documentation!

“Transit + OSMnx”
by Filip Wodnicki

Final project submission for:

Harvard Extension School
Advanced Python for Data Science (CSCI E-29)
Spring 2021

Domain: transportation, public transit, urban planning, networks, graphs

Bottom line: Networks and multimodal routing!

Google Maps

Transit + OSMnx

Google Maps

Transit + OSMnx

On the left are these google map directions, on the right are the same multi-modal transit directions built with transit + osmnx.

Transit + OSMnx

Objective

Build a multi-modal walking and transit network, with Python, open source libraries, and open data.

Getting started

Basic usage

make data
from final_project import WalkNetwork, TransitNetwork, MultiNetwork

# Make a MultiNetwork
W = WalkNetwork.create_from_name("Boston")
T = TransitNetwork.create_from_gtfs("data/MBTA_GTFS.zip")  # Uses the GTFS from Makefile
WT = MultiNetwork.combine(walk=W, transit=T)

# Map it
m = WT.mapper
m

# Route on it!
BOS_airport = (42.36924490636996, -71.02041230759893)
harvard_DCE = (42.375019663272305, -71.12022229636055)

shortest_route, shortest_dist = WT.get_shortest_pair(origin=BOS_airport, dest=harvard_DCE)

Installation

conda install -r requirements.txt
git clone https://github.com/csci-e-29/2021sp-final-project-filipwodnicki.git

Background

The python library osmnx introduced the ability to easily download OpenStreetMap (OSM) data and build a queryable networkx graph of a) road, b) walking, and c) bike path networks for analysis. However, OSM is a limited and incomplete source of data on actual public transport services. In contrast, libraries like peartree and pandana create spatio-temporal models of public transport systems based on GTFS schedule data. However, these libraries don’t integrate those public transport models back into the surrounding walking and biking networks, leaving them out of context of the greater urban fabric.

Approach

  1. Explore.

  2. Solve.

  3. Refactor.

Deliverables

Library

See the Code Reference and repo

Demo

See Demo.ipynb where we walk through combining the walking and transit networks of New Orleans.

Architecture

architecture diagram

Advanced Python

Please see the writeup on concepts used here: Discussion - Advanced Python Concepts.

Conclusion

The main contribution of this project is a toolkit for solving a real-world problem routing in new ways. The mission of building a Multi-modal Transit+Walking graph was achieved! An R&D process (Explore, Solve, Refactor) came out of this project.

Acknowledgements

Thank you Prof Gorlin and teaching staff. I dreamed of doing projects like this for fun. And now, I can(!!)


Future

But it’s not the end! Here are some ideas for next steps:

  • Address WIP: namely testing

  • Contribute to osmnx or Peartree

  • Scale Pandas operations via Dask - How could be build and store a MultiNetwork for the whole world!?

  • Build out visualization - e.g. time isochrone of places accessible within 15 minutes

  • Expose routing as API via Django

  • And more…