Home

Awesome

About

This Ruby script is used to convert a set of GTFS files into a SQLite database + GeoJSONs needed by the Transit Map web application that animates vehicles on a map based on timetables and network.

The script was tested on OSX machines with Ruby 2.x

Install

bundle install

Setup

Parse GTFS data

In a terminal window run the following Rake tasks:

cd /path/to/GTFS-viz

# Initialize folders and the SQLite DB
rake setup:init	

# Fill the DB tables defined in ./inc/gtfs_mapping.yml
rake parse:gtfs_2_sqlite

# Generate GeoJSON files from shapes.txt and stops.txt
# If the shapes.txt is missing from the GTFS dataset, generate one based on stops.txt
rake parse:shapes_2_geojson
rake parse:stops_2_geojson

# Generate KML files from shapes.txt and stops.txt
rake parse:gtfs_2_kml

# Find the position of the stops along the shapes, store them in ./tmp/sfmta/trips_shapes.json
rake parse:stops_interpolate

# Update DB trips and stop_times
rake parse:stops_trips_update

Check the contents of ./tmp/sfmta - http://screencast.com/t/V3r5TZBn0m

Visualize

You can open the GeoJSON files with QuantumGIS or any other GIS software. Same with the KML files which can be visualized using Google Earth.

If you want to create an animation of the GTFS data you will need to

Setup Fusion Tables API

Update Transit-Map project

Now, you should be able to see some action in your browser :)

Swiss railways(SBB) Check SBB network - http://maps.vasile.ch/transit-sbb/

License

Copyright (c) 2014-2015 Vasile Coțovanu - http://www.vasile.ch

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: