purfufna
purfufna

Reputation: 101

How to get all transit stations in Google Maps Directions api?

I made a HTTP request to a Google Maps Directions which includes transit step. The transit step in the response only returns object with information about departure and arrival stops and a number of stops in between them (5).

<transit_details>
      <departure_stop>
        <name>Wien Mitte-Landstraße</name>
        <location>
          <lat>48.2060950</lat>
          <lng>16.3848860</lng>
        </location>
      </departure_stop>
      <arrival_stop>
        <name>Wien Hbf (Bahnsteige 1-2)</name>
        <location>
          <lat>48.1861220</lat>
          <lng>16.3755230</lng>
        </location> 
      </arrival_stop>
      <line>  
        <short_name>S 1</short_name>
        <vehicle>
          <name>Commuter train</name>
          <type>COMMUTER_TRAIN</type>
          <icon>//maps.gstatic.com/mapfiles/transit/iw2/6/rail.png</icon>
        </vehicle>
        <agency>
          <name>ÖBB</name>
          <url>http://www.oebb.at/</url>
        </agency>
      </line>
      <num_stops>5</num_stops>
      <headsign>Mödling</headsign>
      <departure_time>
        <value>1439805780</value>
        <text>12:03pm</text>
        <time_zone>Europe/Berlin</time_zone>
      </departure_time>
      <arrival_time>
        <value>1439806200</value>
        <text>12:10pm</text>
        <time_zone>Europe/Berlin</time_zone>
      </arrival_time>
    </transit_details>

What I need are the details of all individual stops along the transit leg. Is there a way to acquire that kind of information?

Upvotes: 4

Views: 2253

Answers (2)

jonaz
jonaz

Reputation: 111

It's not currently possible in the Google API to get that information. There's an issue under review to be added in the gmaps api bug tracker: https://code.google.com/p/gmaps-api-issues/issues/detail?id=7807

Be sure to click the star to show your support to add it.

Upvotes: 2

Verma
Verma

Reputation: 8439

For each waypoint in the request, the directions response includes an additional entry in the legs array to provide the corresponding details for that leg of the journey.

Upvotes: 0

Related Questions