【问题标题】:In MKMapview how to get the list of driving direction in ios在 MKMapview 中如何获取 ios 中的行车方向列表
【发布时间】:2013-05-06 14:02:22
【问题描述】:

在地图视图中,我正确地获得了从源到目的地的路线。但我想在地图视图中获取路线方向列表。我在一个示例链接下面添加了,同样我需要。 iphone可以吗?如果可以,请帮助我。 http://thumblines.com/2012/02/05/driving-directions-in-native-ios-and-android-apps/ 现在我正在使用下面的代码,但它不起作用。

NSString *googleMapsURLString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f", start.latitude, start.longitude, end.latitude, end.longitude];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]];

【问题讨论】:

  • 这与mapkit无关。

标签: iphone ios mkmapview


【解决方案1】:

使用 Google Direction API,可以轻松找到两地之间的方向。它根据用户要求以 json/xml 的形式给出响应。这是一个示例 API,用于找出两地之间的方向。

http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false

现在只需解析作为以下 API 响应的 json,就可以轻松获取方向指令。您可以通过替换不同 Places 的文本来检查此 API 的可移植性。希望对你有帮助。

【讨论】:

  • 感谢您的 rply。我如何仅从 API 响应中获取方向指令。
猜你喜欢
  • 1970-01-01
  • 2012-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-16
  • 1970-01-01
  • 2021-06-24
  • 2020-03-03
相关资源
最近更新 更多