Walking, bicycle and public transport directions with time required in each mode , iPhone

只谈情不闲聊 提交于 2019-12-10 10:15:07

问题


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.


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!