--- a/maxious-canberra-transit-feed/04-generateymlinclude.rb +++ b/maxious-canberra-transit-feed/04-generateymlinclude.rb @@ -1,10 +1,10 @@ #!/usr/bin/ruby -require 'postgres' require 'highline.rb' include HighLine require 'rubygems' +require 'postgres' require 'json' require 'yaml' require 'pp' @@ -19,7 +19,7 @@ f2.puts header f2.puts "stops:\n"; begin - time_points = connbus.exec("SELECT * from timing_point") + time_points = connbus.exec("SELECT * from timing_point ORDER BY name") rescue PGError => e puts "Error reading from DB #{e}" #conn.close() if conn @@ -30,7 +30,22 @@ # 1 = lat*100000 # 2 = lng*100000 + #pp time_point[0] f2.puts " - { name: #{time_point[0]},stop_code: #{time_point[0]}, lat: #{Float(time_point[1])/10000000}, lng: #{Float(time_point[2])/10000000}}" + end + begin + stops = connbus.exec("SELECT * from stops") + rescue PGError => e + puts "Error reading from DB #{e}" + #conn.close() if conn + end + stops.each do |stop| + #pp stop + # 0 = geoPo + # 1 = lat*100000 + # 2 = lng*100000 + #pp time_point[0] + f2.puts " - { name: #{stop[0]},stop_code: #{stop[0]}, lat: #{Float(stop[1])/10000000}, lng: #{Float(stop[2])/10000000}}" end f2.puts "routes:\n"; end