2

I've been programming PHP for a couple of years, and I'm looking at tackling the GTFS real time feeds. I've downloaded the GTFS files for a specific agency and am parsing them with PHP using the fgetcsv function.

What I'm stuck on right now is, how the HECK do I use this information to find service delays etc. I'm used to parsing information through XML apis etc, but have not dealt with anything like this before. It seems that it requires some python knowledge which I do not know, but am willing to learn.

If anyone can provide me with proper guidance, I'd GREATLY appreciate it. I can get it to store the records into MySQL, but am not sure if I just need to create queries against the current timestamp vs. the expected timestamp to see if there is a delay. I'm having a hard time trying to figure out what to do next.

Any guidance would be greatly appreciated.

user1701252
  • 1,501
  • 1
  • 11
  • 19
  • That's a question that would fit perfectly with http://area51.stackexchange.com/proposals/49339/open-transportation-technology – gcamp Jan 27 '13 at 01:11

1 Answers1

2

Just to be clear, you are working with both a GTFS feed and a GTFS-realtime feed, correct?

My understanding is that to generate up-to-date schedule information for a stop, the basic procedure is

  • From the GTFS feed, obtain a set of trip ID/stop-sequence pairs for vehicles arriving at the stop within, say, the next hour.
  • From the GTFS-realtime feed, obtain updated arrival and departure times for each trip ID/stop-sequence pair, if present in the feed.

The realtime feed will provide either absolute times or relative ones (i.e. delays); the schedule times given in the GTFS data let you convert from one to the other.

  • Does anyone know how to pull historical alerts for an agency from either google or the agency itself? What I'd like to do is get all alerts that occurred within a given date range (not just current alerts). – George Dec 22 '12 at 18:23
  • @user1100652 You could try approaching the agency directly. Otherwise I don't believe there are any sites currently that archive realtime transit data. Building a site that does this, and perhaps publishes a few statistics from the data, might be an interesting project. –  Dec 22 '12 at 22:29