Code Monkey home page Code Monkey logo

transit-simulator's Introduction

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

transit-simulator's People

Contributors

moshobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

yelper

transit-simulator's Issues

Generalize basemap coordinates

Currently, the coordinates used for the Basemap have to be manually configured:

my_map = Basemap(llcrnrlon=-122.5, llcrnrlat=47.4, urcrnrlon=-122.1, urcrnrlat=47.75,
            projection='lcc', resolution='f', lat_0=47.5, lon_0=-122.3)

It would be better if the coordinates were set based on the coordinates of the data to be plotted. There should be some standard constant to multiply the coordinates by to get the values used in Basemap. For example, perhaps the upper right corner's latitude (urcrnlat) should be 10% more than the largest latitude to be plotted.

In addition, the center of the map (as set by lat_0 and lon_0 should also be calculated`.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.