我想找到我使用google api绘制的Polyline的原点纬度长和目标纬度之间的距离。
答案 0 :(得分:0)
表格CLLocation对象,如
CLLocation *sourceLocation = [[CLLocation alloc]initWithLatitude:sourceCoordinate.latitude longitude:sourceCoordinate.longitude];
CLLocation *destinationLocation = [[CLLocation alloc]initWithLatitude:destinationCoordinate.latitude longitude:destinationCoordinate.longitude];
并将它们传递给此方法。
-(CLLocationDistance)getDistanceFromSource:(CLLocation*)source andDestination:(CLLocation*)destination {
CLLocationDistance distance = [source distanceFromLocation:destination];
return distance;
}