Is there a Google Transit API available?

16,397

Solution 1

Now, both Google Directions Web Services and Google Maps JavaScript API include building the routes with Public Transit.

Blog post:

http://googlegeodevelopers.blogspot.com/2012/06/public-transit-routing-and-layer-now.html

API docs:

https://developers.google.com/maps/documentation/directions/#TravelModes https://developers.google.com/maps/documentation/javascript/directions#TransitOptions

Solution 2

Most travel agencies do not allow Google to disclose their data as public API. Thus, there is no "easy" and reliable way to integrate Google Transit.

However, there is at least one way to do that in more difficult manner: request maps.google.com with special query parameters and then parse a JSON-like string with embedded HTML. You may have a look at my blog post to get some introduction to this option: http://mikhail.io/2012/04/10/google-transit-api-research/

I don't share any code there, but the task is doable.

Solution 3

There are feeds available for developers to consume and endpoints for transit agencies to upload transit data: https://developers.google.com/transit/

Here are some examples: https://developers.google.com/transit/gtfs/examples/

Solution 4

You can just use Google's Directions API. It incorporates all transit (scheduled or real-time) data it has into results, returned to you via JSON, for your apps.

https://developers.google.com/maps/documentation/directions/

Make a http API query and pass in the start and end points, turn on transit, and it will return JSON you can parse.

http://maps.googleapis.com/maps/api/directions/json?origin=1500+Goddard+Avenue%2C+Louisville%2C+KY&destination=2100+S+Preston+St.%2CLouisville%2CKY&sensor=true&arrival_time=1396696559&mode=transit

Note the 'mode' parameter equal to 'transit'.

Share:
16,397
user1259552
Author by

user1259552

Updated on June 05, 2022

Comments

  • user1259552
    user1259552 almost 2 years

    I'm working on a mobile app for Android and iOS. The customer is a public transport company, and they have requested we integrate Google Transit.

    Is there an API available for Google Transit? That would make it easy on us.
    Thanks!