Skip to content

moshobo/Transit-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transit-Simulator

Python code for simulating transit lines based on GTFS data

lightrail_2024-04-27

Inspiration

This project is inspired by @QuadMet on Twitter/X who created an animation of Portland, OR transit vehicles based off of GTFS data. They used the 'GTFS Map Generator' from Dan Snow (checkout some simulations of their the Chicago L Trains). However, that code was in R, and I don't know R, so I decided to redo it all in Python.

How it works

Most of the heavy lifting is being done by gtfs_kit, which take in GTFS feed data and allows you to query it in a number of ways. The most important part of this is feed.locate_trips(), which is able to figure out where transit vehicles are at a given point in time.

Matplotlib's FuncAnimation is then used to animate the vehicles over an array of times

Where do I get GTFS data?

Most transit agencies will make their GTFS data availble for public download, so just try searching for " GTFS data". As an example, Sound Transit provides GTFS data for most transit agencies in the Seattle area on their website

About

Python code for simulating transit lines based on GTFS data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages