How to get nearby stations and next departures from google maps transit api

Viewed 2044

Can I make a queries to the transit part of the google maps API that

  1. For a given GPS coordinate, give me nearby stations?

  2. For a given stations, give me the next departures?

Google maps itself provides that information (see screenshot). But is this information accessible through the API? Screenshot

1 Answers

Not everything that the Google Maps app can do are readily available in the Google Maps Javascript API / Web services. So don't expect to be able to copy the Google Maps app features.

You can easily get transit_stations by using a Places Nearby Search. See docs: https://developers.google.com/maps/documentation/javascript/places#place_search_requests

But you can only get departure times of a transit stop in the context of a Directions query. https://developers.google.com/maps/documentation/javascript/directions#TransitInformation

Related