I am using following url to get driving directions between two locations.
NSString* apiUrlStr = [NSString stringWithFormat:@"http://maps.google.com/maps?output=dragdir&saddr=%@&daddr=%@", saddr, daddr];
What changes need to be done in above query to get directions for bicycle, walking or public transport and corresponding distance, time required between two places?
Thanks in advance for any help.
viggio24
You must use the "dirflg=?" parameter, where "?" can be:
dirflg Route type. dirflg=h Switches on "Avoid Highways" route finding mode. dirflg=t Switches on "Avoid Tolls" route finding mode. dirflg=r Switches on "Public Transit" - only works in some areas. Can also set date and time info described below. dirflg=w Switches to walking directions - still in beta. dirflg=b Switches to biking directions - only works in some areas and still in beta.
There are many other params available, read the Google Maps Parameters doc, but of course not all of them are supported by the Maps native API (which is updated at every iOS release). Is up to you to test them as the official Apple doc is not always up to date with all features.
来源:https://stackoverflow.com/questions/7632844/walking-bicycle-and-public-transport-directions-with-time-required-in-each-mode