iOS:两个位置之间的路线距离(路线,而不是直线) [英] iOS: distance of route between two locations (route, not straight line)
问题描述
我被困在距离。在iOS 5之前,我可以使用Google方向API来获取距离,但现在我不能。有没有其他解决方案?
谢谢!
编辑:
我所指的距离是两个地点之间路线的距离。路线有很多路线。 distanceFromLocation:的结果不是直线的距离
现在(iOS 7及更高版本)获取MKDirections,MKDirectionsRequest和MKDirectionsResponse的路由。
路线信息是MKRoute(有一个距离属性)。
例如按照此链接。
I have a MKMapview with multiple annotations. When the user chooses an annotation, the "callout" view shows the location's name and the distance between the location and the user location.
I'm stuck at getting the distance. Prior to iOS 5, I could use Google direction API to get the distance, but now I can't. Is there any alternative solution?
Thank you!
EDIT:
The distance I refer is the distance of the route between two locations. The route has many routes. It's not the distance of the straight line as the result of "distanceFromLocation:"
Now (iOS 7 and later) you can get a route with MKDirections, MKDirectionsRequest and MKDirectionsResponse.
The route information is MKRoute (there's a distance property).
For an example follow this link.
这篇关于iOS:两个位置之间的路线距离(路线,而不是直线)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!