我可以删除所需点的两个注释(源,目标)。但是,现在我想确定它们之间的距离。我寻找解决方案,并在跨越一个传来: Calculating distance between two points计算两个注释之间的距离:iOS 5
但解决的办法:
CLLocationDistance distance = [location1 getDistanceFrom:location2];
getDistanceFrom:
中的iOS 5已弃用请任何人可以建议我的方式来做到这一点使用谷歌地图API
CLLocation *locA = [[CLLocation alloc] initWithLatitude:coordinate.latitude longitude:coordinate.longitude];
CLLocation *locB = [[CLLocation alloc] initWithLatitude:coordinate2.latitude longitude:coordinate2.longitude];
CLLocationDistance distance = [locA distanceFromLocation:locB];
NSLog(@"DISTANCE : %f", distance/1000);
:找点
之间的实际距离而查找的选项,我碰到另一种解决方案来
但是,我不确定这个解决方案是否正确。它返回的距离是道路之间源和目的地之间的实际距离?我试图在谷歌地图上比较它,它大致匹配。请验证它的正确方法?
在此先感谢
distanceFromLocation使用一条直线(沿地球表面),而不是一条公路。 http://developer.apple.com/library/ios/DOCUMENTATION/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html#//apple_ref/occ/instm/CLLocation/distanceFromLocation: – Craig
请给我一种我可以使用的方式在寻找沿路的距离 – iDev