Code Monkey home page Code Monkey logo

gtfs's Introduction

Rewrite of transitfeed

>>> import gtfs
>>> sched = gtfs.load( "bart.zip" )

( it takes a minute or two to load )

>>> sched.stops
[<Stop POWL>, <Stop ROCK>, <Stop SANL>, <Stop SHAY>, <Stop SSAN>, <Stop UCTY>, <Stop WCRK>, <Stop WOAK>, <Stop COLM>, <Stop MLBR>, <Stop RICH>, <Stop SBRN>, <Stop SFIA>, <Stop OAK>, <Stop 12TH_N>, <Stop MCAR_S>, <Stop 12TH>, <Stop 16TH>, <Stop 19TH>, <Stop 24TH>, <Stop ASBY>, <Stop BALB>, <Stop COLS>, <Stop CONC>, <Stop DALY>, <Stop DBRK>, <Stop DELN>, <Stop DUBL>, <Stop EMBR>, <Stop FRMT>, <Stop FTVL>, <Stop GLEN>, <Stop HAYW>, <Stop LAFY>, <Stop LAKE>, <Stop MCAR>, <Stop MONT>, <Stop NBRK>, <Stop NCON>, <Stop ORIN>, <Stop PHIL>, <Stop PITT>, <Stop PLZA>, <Stop BAYF>, <Stop CAST>, <Stop CIVC>]
>>> sched.routes
[<Route AirBART>, <Route 01>, <Route 02>, <Route 03>, <Route 04>, <Route 05>, <Route 06>, <Route 07>, <Route 08>, <Route 11>, <Route 12>]
>>> sched.service_periods
[<ServicePeriod WKDY 1111100>, <ServicePeriod SAT 0000010>, <ServicePeriod SUN 0000001>, <ServicePeriod M-FSAT 1111110>, <ServicePeriod SUNAB 0000001>]
>>> # pretty much all relationships are mapped 
>>> sched.stops[0].stop_times[0].trip.route.agency
<Agency BART>
>>> sched2 = gtfs.load( "bart.zip", "bart.db" ) # uses a disk-based db instead of a memory db

( this takes just as long as the first time )

>>> sched2  # it's very similar to the first, except ...
<gtfs.schedule.Schedule instance at 0xdeadbeef>
>>> exit()
$ python
>>> from gtfs import Schedule
>>> sched = Schedule( "bart.db" ) # this takes no time at all
>>> sched.stops
[<Stop POWL>, <Stop ROCK>, <Stop SANL>, <Stop SHAY>, <Stop SSAN>, <Stop UCTY>, <Stop WCRK>, <Stop WOAK>, <Stop COLM>, <Stop MLBR>, <Stop RICH>, <Stop SBRN>, <Stop SFIA>, <Stop OAK>, <Stop 12TH_N>, <Stop MCAR_S>, <Stop 12TH>, <Stop 16TH>, <Stop 19TH>, <Stop 24TH>, <Stop ASBY>, <Stop BALB>, <Stop COLS>, <Stop CONC>, <Stop DALY>, <Stop DBRK>, <Stop DELN>, <Stop DUBL>, <Stop EMBR>, <Stop FRMT>, <Stop FTVL>, <Stop GLEN>, <Stop HAYW>, <Stop LAFY>, <Stop LAKE>, <Stop MCAR>, <Stop MONT>, <Stop NBRK>, <Stop NCON>, <Stop ORIN>, <Stop PHIL>, <Stop PITT>, <Stop PLZA>, <Stop BAYF>, <Stop CAST>, <Stop CIVC>]
>>> sched.stops[0].stop_times[0].trip.route.agency
<Agency BART>

gtfs's People

Contributors

bfontaine avatar bmander avatar kurtraschke avatar wlach avatar

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.