0

I have a google maps directions link shown in XML:

http://maps.googleapis.com/maps/api/directions/xml?origin=111%20Davisville%20Avenue,Toronto,ON&destination=469%20King%20Street%20West,%20Toronto,%20ON&sensor=false&dirflg=r

Even though it has the drection flag dirflg=r at the end to swich to public transit directions, its still showing the driving directions. Is there any fix to this?

Thanks in advance. I searched around but couldn't find anything that answers exactly this.

John Conde
  • 217,595
  • 99
  • 455
  • 496
C0D3
  • 6,440
  • 8
  • 43
  • 67
  • The Google Maps API do not currently let you query for public transit directions. See http://code.google.com/p/gmaps-api-issues/issues/detail?id=713#c76 for the reason from Google. – Jeow Li Huan Dec 25 '11 at 15:41
  • Is there anyway to fetch this data then? Maybe using Bing or MapQuest? Or perhaps using Google's json object api instead of xml? – C0D3 Dec 26 '11 at 17:13
  • Did you find a way to query the Google Maps for transit data and use it in Android and iOS mobile applications? – Alex Bitek Mar 20 '12 at 16:35
  • Unfortunately Google doesn't let you query for transit data. But I found this: http://www.nextbus.com/homepage/ . They also provide an xml web service. This might also help: http://stackoverflow.com/questions/8735938/google-maps-directions-in-xml-or-json-with-other-travel-modes – C0D3 Mar 20 '12 at 17:48

1 Answers1

0

You can't get a direct web feed but you can get a json file.

use the output=json property/value at the end of your url.

eg: https://maps.google.com/?saddr=546+6th+Avenue,+New+York,+NY+10011+(Sixth+Avenue,+New+York)&daddr=W+103rd+St,+New+York,+NY+&dirflg=r&output=json

Matt Sich
  • 3,905
  • 1
  • 22
  • 26
  • The Google Maps API do not currently let you query for public transit directions. See code.google.com/p/gmaps-api-issues/issues/detail?id=713#c76 for the reason from Google. But I will still accept this as the correct answer. – C0D3 Nov 30 '12 at 23:01