1

I am building an application using GTFS data. I am a bit confused when it comes to GTFS-realtime.

I have stored all the GTFS information in a database(Mongo), I am able to retrieve stop times of a specific bus stop.

So now I want to integrate GTFS-realtime information to it. What will be the best way to deal with the information retrived? I am using gtfs-realtime-binding (nodsjs library) by Google.

I have the following idea: Store the realtime-GTFS information in a separate database and query it after getting the stoptime from GTFS. And I can update the database periodically to make sure the real time info is up to date.

Also, I know the retrieve data is in .proto binary format. Should I store them as ascii or is there a better way to deal with it?

I couldnt find much information about how to deal with the realtime data so I hope someone can give me a direction on what to do next.

Thanks!

Timothy Leung
  • 1,407
  • 7
  • 22
  • 39
  • What is your goal for using GTFSrt? to include this in an application in realtime, or for analysis after the fact? – Tony Laidig Jun 16 '17 at 16:51
  • @Laidig It is for real time. I am thinking should I just leave the realtime data in memory or store them into database. – Timothy Leung Jun 17 '17 at 05:12

1 Answers1

1

In your case GTFS-Realtime can be used as "ephemeral" data, and I would go with an object in memory, with the stop_id/route_id as keys.

For every request: Check if the realtime object contains the id, then present realtime. Else load from the database.

Tony Laidig
  • 1,048
  • 2
  • 11
  • 33