iphone谷歌地图 - 方向使用经度和纬度

问题描述:

我正在iphone应用程序。 我知道我的当前位置(经度和纬度)和目的地(经度和纬度)。 如何使用“Google地图”查找路线。谷歌地图的URL就像“http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino
从上面的URL,尽管来源和目的地的地方我想使用经度和纬度。怎么样?iphone谷歌地图 - 方向使用经度和纬度

NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", 
              currentLocation.coordinate.latitude, currentLocation.coordinate.longitude, 
              destLocation.coordinate.latitude, destLocation.coordinate.longitude]; 

[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]]; 
+0

非常感谢,它的工作 – Satyam 2010-05-10 04:35:57

+0

嘿感谢它的工作FR我也 – Swati 2010-09-21 10:58:31

你有没有尝试过把纬度和经度作为参数?根据我的经验,Google API对于您可以投入的内容非常松散。例如,Google本地API可以采用几乎所有的东西,包括纬度。