Timothy Leung
Timothy Leung

Reputation: 1465

Using GTFS data, how should i extend it with realtime gtfs?

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!

Upvotes: 1

Views: 486

Answers (1)

Tony Laidig
Tony Laidig

Reputation: 1078

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.

Upvotes: 1

Related Questions