Rob Lourens
Rob Lourens

Reputation: 16099

Link directly to Google Maps transit directions mobile site

If you visit maps.google.com on a mobile device, then press 'Menu', 'Get Directions', and select the 'transit' option, you are taken to a page where you can enter two locations and a date/time, and get directions on public transit. However, the URL is still maps.google.com.

Is there any way to link directly to this page so that I can load it in a UIWebView in my iOS app? Would 'clicking' the buttons in Javascript be (the only/a good) solution?

Upvotes: 0

Views: 1750

Answers (3)

stevevance
stevevance

Reputation: 401

You could create a URL that links to the transit directions with the "dirflg=r" paramater.

Find the other URL parameters here: http://web.archive.org/web/20110714031648/http://mapki.com/wiki/Google_Map_Parameters

Upvotes: 0

Rob Lourens
Rob Lourens

Reputation: 16099

Even clicking the buttons in javascript doesn't seem to be working. The Google Maps code is a little strange- the event listeners aren't assigned directly and I can't get a .click() to work. So what I'll do is have the user enter the two locations in boxes in the app, then load something like http://maps.google.com/maps?f=d&source=s_d&saddr=Coover+Hall&daddr=lied+rec+center in the UIWebView, except I'll add some more specific location information before building the URL, since this is a city-specific app. Not a perfect solution but it gets the job done.

Upvotes: 0

Kai
Kai

Reputation: 9288

Try: http://www.google.com/transit

Upvotes: 1

Related Questions