Skip to content

mnoble01/comp120a3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heroku URL:
http://comp120a3.heroku.com

NOTES: ~ unable to add all stations to map at this time. using cartographer. looking into it.
tried:     1. adding them to @map.markers as soon as created, within station loop
		2. adding them to an array of markers within station loop, then adding to @map.markers in a second loop


TO REPLICATE:

configure the config/database.yml file to correspond with your db!

Station model:
    rails generate model Station line:string platform_key:string platform_name:string station_name:string platform_order:integer startofline:boolean endofline:boolean branch:string direction:string stop_id:string stop_code:string stop_name:string stop_desc:string stop_lat:decimal stop_lng:decimal
- run   rake db:migrate
- then change the precision, scale in db/schema.rb AND in db/migrate/..._create_stations.rb:     :precision => 8, :scale => 6
- run   rake db:rollback   THEN   rake db:migrate   AGAIN
- then:   move csv to lib/   AND   update db/seeds.rb: 
		seeds.rb: 
			require 'csv'
			Station.delete_all # start fresh with empty db
			CSV.foreach "lib/mbta_data.csv" do |row|
    				Station.create(:line => row[0], :platform_key => row[1], :platform_name => row[2], :station_name => row[3], :platform_order => row[4], :startofline => row[5], :endofline => row[6], :branch => row[7], :direction => row[8], :stop_id => row[9], :stop_code => row[10], :stop_name => row[11], :stop_desc => row[12], :stop_lat => row[13], :stop_lng => row[14])
			end
- run:   rake db:seed

Mapper controller:
    rails generate controller Mapper station find_closest_stations station_schedule index

Cartographer:
    run:   rails plugin install git://github.com/joshuamiller/cartographer.git
    add as first line to config/environment.rb:     CARTOGRAPHER_GMAP_VERSION = 3

added to Gemfile:
	(make sure correct db gem is there also)
    gem 'json'
    gem 'geokit-rails3'
- then run:    bundle install

update all app/ files from TUFTS CS folder
update the config/routes.rb file
move mbta image to public/images/

REMOVE public/index.html

Create GIT repo & git init a local, and push

HEROKU (AFTER setting up git & populating db):
	- heroku create <project_name>    // will be <project_name>.heroku.com
	- git push heroku master    // deploy to heroku - FIRST TIME
								 // subsequent times use: git push -f heroku (-f forces the command)
	- heroku rake db:migrate    // updates heroku w/ necessary data models
	- heroku db:push    // pushes actual data up to cloud -- careful! erases current cloud data every time    (will ask for confirm. may have to 'gem install taps' first.)

About

MBTA real-time data API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published