Skip to content
This repository

OpenSource web application to import and display bus lines information (for the STAR network in Rennes, TUAS in St Lô)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 autotest
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 doc
Octocat-spinner-32 lib
Octocat-spinner-32 public
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Capfile
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 config.ru
Octocat-spinner-32 schema.draw
README.textile

Star GTFS

This is a Ruby on Rails application to play (or even do useful stuffs) with the GTFS dataset provided by Keolis Rennes for the bus network of the city of Rennes, France and with the dataset of the bus network of St Lô, France, privately provided by the network, TUSA. You can find an instance of this application running as Bus de Rennes en Ligne.

Requirements

  • Ruby 1.9;
  • PostgreSQL 8.4;
  • PostGIS 1.5;
  • Apache Solr;
  • Time.

Hey, I want to run my own instance!

So, you want to use this application or do things with, you have just checked out the latest version from the repository and ran bundle to update your rails environment. What’s next?

You want to initialize the database with the official dataset: Fetch the zip file from the Keolis website and unzip it in tmp/, set an environment variable KEOLIS_API_KEY with, well, an API key from Keolis, fetch the KML file of the network from the Rennes Métropole OpenData repostiory and just run the following:

    % rake db:schema:load
    % rake stargtfs:import[rennes] 
    % rake sunspot:solr:reindex

The import task takes the various csv files and put some parts into a database, plus some more that I thought more efficient at runtime (like, say, not using trips but directly linking lines, stops and stop_times).

You can now start your server and point your browser at your usual URL (say, http://localhost:3000/).

Hey, what have you done to the data?

I know the license (in theory), doesn’t really allow me to do everything there, but my import process does a few things more than just importing raw CSV rows.

  • Agglomeration of “stops”. The STAR GTFS data set seems to have this little thing that makes stops of the same station different stops GTFS-speaking. And some stations are really detailled and spread out in different stops for differents lines. And it sucks. So I take all the stops that almost bear the same name and are close enough to have only one stop instead;
  • As said earlier, linking directly routes, stops and stop_times instead of going through trips;
  • Reducing the number of calendars. Each calendar of this GTFS data set only covers a day even though trips are repeated. So I try to find all trips that look the same (same stops sequence and timing) to only keep one of each (but I don’t do so for the week-end trips, as it looks better that way);
  • Stripping line names. Not visible on the web version, but I reduce the length and complexity of line names for the mobile version, while we’re at it;
  • Computing the bearing of trips. “this line goes to Wherevercity, but does it go North or South?” Well, here’s the answer (that’s a small bonus, but I love small bonuses);
  • Geekification of calendar. Having 7 columns to store related booleans sucks. Look, Ma’, I know binary operators! (given the fact that the calendar here is under-used, this allows me to drop the calendar altogether and only use one byte to store this information);

License

All the code in this repository, unless otherwise noted is under AGPL v3. (as far as I understand, that means “do (almost) whatever you want if you do opensource too, but if you do even services (aka, a web app) with it as closed source, you’ll hurt small kitties” (and you don’t want to hurt small kitties, do you?)

The bus-like icons are derived from icons that can be found within the Google Maps Icons project and are CC3.0-BY-SA.

Something went wrong with that request. Please try again.