user1388070
user1388070

Reputation: 171

How to get google transit data by api

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?

Upvotes: 12

Views: 18785

Answers (3)

Drew Dara-Abrams
Drew Dara-Abrams

Reputation: 8054

The Transitland platform aggregates transit data from thousands of agencies around the world (using their GTFS and GTFS Realtime feeds) and provides a series of APIs you use to power your own app.

The best API to start with now is the Transitland v2 REST API. Depending upon your needs, you may also want to check out the other APIs.

As other answers have also mentioned, you do also have the option to download and parse GTFS feeds yourself. This isn't hard to do, but the question is usually whether your application will use one GTFS feed, dozens, or hundreds — the more agencies and feeds you need, the more benefit you'll probably find using a service like Transitland APIs.

Sources for downloading GTFS feeds:

  1. Transitland's list of feeds (click through to download any feed version)
  2. OpenMobilityData (formerly known as TransitFeeds.com) - will be deprecated soon, but still has a wide archive of feeds to download
  3. Go directly to transit agency websites and download from them

Upvotes: 1

Trott
Trott

Reputation: 70075

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.)

Upvotes: 2

syedfa
syedfa

Reputation: 2809

and thanks for posting your question. I too am working on a similar transit project on my own, and I think to answer your question, the best answer was provided here:

https://stackoverflow.com/a/10083926/458811

I wish I had something original to provide on my own, but I'm trying to use the data that my city provides and develop an algorithm on my own that serves as a trip planner. By no means is this an easy task, but I guess that's what separates the good developers from the mediocre ones. Please contact me if you have any ideas, and I hope you do well on your thesis project.

Take care. Sincerely; Fayyaz

Upvotes: 1

Related Questions