在google map中使用目标c ios打开获取方向与多个停靠点 [英] open Get Direction with multiple stops in google map from using objective c ios
问题描述
我正在使用谷歌地图sdk,现在我想打开Google地图中的有多个站点的地图,就像我在地点 A ,并从该地图要前往位置 B,C,D ,我可以打开位置 A到B 的Google地图,但无法打开 A到B,C ,d 即可。
我如何做到这一点我试过这个
NSString * str1 = [NSString stringWithFormat:@http:// maps.google.com/?saddr=%@&daddr=%@&waypoints=%@&key=%@\",originString,destinationString,strWayPoints,GOOGLE_API_KEY];
if([[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:@comgooglemaps://]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString :STR1]];
}
// str1 =
http://maps.google.com/?saddr = 18.518205,73.857431& daddr = 18.518205,73.857431& waypoints = via:18.518205,73.857431 | via:18.552248,73.901596 | via:18.629764,73.934685& key = MYKEY
您应该使用 Google地图网址提供通用跨平台语法来在移动应用程序或Google Maps网站中打开地图。
在路线模式下,您可以指定路线的出发地,目的地和多个航点。有关详情,请参阅以下页面:
https://developers.google.com/maps/documentation/urls/guide#directions-action
网址示例:
https://www.google.com/maps/dir/?api=1&origin=18.518205,73.857431& ; destination = 18.518205,73.857431& waypoints = 18.518205,73.857431 | 18.552248,73.901596 | 18.629764,73.934685
我希望这有助于!
I am using google map sdk and now i want to open get direction in google map where there are multiple stops like i am at Location A and from that i want to go to locations B,C,D i am able to open google map with location A to B but not able to open it for A to B,C,D. How can i do this i tried this
NSString *str1 =[NSString stringWithFormat:@"http://maps.google.com/?saddr=%@&daddr=%@&waypoints=%@&key=%@",originString,destinationString,strWayPoints,GOOGLE_API_KEY];
if([[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:@"comgooglemaps://"]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str1]];
}
//str1 =
http://maps.google.com/?saddr=18.518205,73.857431&daddr=18.518205,73.857431&waypoints=via:18.518205,73.857431|via:18.552248,73.901596|via:18.629764,73.934685&key=MYKEY
You should use Google Maps URLs that provides universal cross platform syntax to open maps in mobile apps or Google Maps website.
In directions mode, you can specify the origin, destination and multiple waypoints for your route. For more details have a look at the following page:
https://developers.google.com/maps/documentation/urls/guide#directions-action
Example of URL:
https://www.google.com/maps/dir/?api=1&origin=18.518205,73.857431&destination=18.518205,73.857431&waypoints=18.518205,73.857431|18.552248,73.901596|18.629764,73.934685
I hope this helps!
这篇关于在google map中使用目标c ios打开获取方向与多个停靠点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!