GithubHelp home page GithubHelp logo

wizcalil / openmbta2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danchoi/openmbta2

0.0 2.0 0.0 4.46 MB

rewrite of OpenMBTA

Ruby 46.39% HTML 34.58% Shell 2.16% JavaScript 14.07% CSS 2.80%

openmbta2's Introduction

OpenMBTA2

A clean rewrite of OpenMBTA.

Setup

Assumes PostgreSQL and PostGIS extensions.

gem install pg

To populate the database, download the GTFS data CSV files into data/ and then run db/runall.sh

Then run

psql mbta < trips-today.sql

ssh [email protected] "pg_dump mbta2 -t nextbus_predictions | gzip -c " | gunzip -c | psql mbta2

Include -a if this is repeated

Before optimization of transit_routes on Dec 11 2013:

curl http://openmbta.org/routes/Bus real 0m2.076s user 0m0.006s sys 0m0.004s

After: real 0m0.884s user 0m0.006s sys 0m0.004s

Now to get number 1 trips:

real 0m3.434s user 0m0.010s sys 0m0.021s

[choi@sparta openmbta2]$ time ruby -Ilib lib/transit_trips.rb 'Green Line' 0 > out

real 0m3.406s user 0m2.969s sys 0m0.099s

zoe@li321-67:~/openmbta2$ ruby -Ilib lib/transit_trips.rb 'Green Line' 0 1>/dev/null select stops.stop_name, st.* from stop_times st inner join stops using(stop_id) where trip_id in (select trip_id from trips_today where route_coalesced_name = 'Green Line' and direction_id = 0) order by stop_id, arrival_time, stop_sequence calc_next_arrivals took 1.511933737 seconds make_grid took 3.588673105 seconds fix_grid_stop_ids took 0.000191765 seconds

Still slow:

ruby -Ilib lib/transit_trips.rb 'Green Line' 0 1>/dev/null select stops.stop_name, st.* from stop_times st inner join stops using(stop_id) where trip_id in (select trip_id from trips_today where route_coalesced_name = 'Green Line' and direction_id = 0) order by stop_id, arrival_time, stop_sequence calc_next_arrivals took 2.102558194 seconds make_grid took 3.095658068 seconds fix_grid_stop_ids took 0.000181157 seconds zoe@li321-67:~/openmbta2$ fg

openmbta2's People

Watchers

James Cloos avatar  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.