How to get google transit data by api

user1388070 picture user1388070 · May 10, 2012 · Viewed 13.9k times · Source

I'm working on a thesis project in order to do an "integrated indoor / outdoor" navigation system for mobile devices (Especially Iphone).

I need information about public transport, until a few days ago I used this service: http://www.google.com/m/directions

but it doesn't work anymore for some reason.

I saw that there are Google APIs directions but they only work in walking, bycicle, driving travel mode and they don't work for "transit mode".

Then I saw that there are no public API for Google Transit service .

I was wondering if there is an "API" or a "way" to extract data from public transportation?

Answer

Trott picture Trott · Aug 4, 2012

Many public transit agencies make their route information available in General Transit Feed Specification (GTFS) format. In fact, this is the format that is used by public transit agencies to submit their information to Google.

You can search for the transit agency of your choice at http://www.gtfs-data-exchange.com/ or look for them at https://code.google.com/p/googletransitdatafeed/wiki/PublicFeeds. You can find out more about GTFS at https://developers.google.com/transit/gtfs/reference.

Of course, you'll have to write your own code to parse the data, probably store it in a database, and determine the best route from point A to point B. But you also don't have to worry about someone else's service suddenly stopping working on you. (The worst thing that can happen is http://www.gtfs-data-exchange.com/ goes away, in which case you need to find another way to keep your data up to date.)