【发布时间】:2016-09-15 10:27:31
【问题描述】:
我想找到我使用 google api 绘制的折线的起点 lat long 和目的地 lat long 之间的距离。
【问题讨论】:
标签: ios objective-c google-maps google-polyline
我想找到我使用 google api 绘制的折线的起点 lat long 和目的地 lat long 之间的距离。
【问题讨论】:
标签: ios objective-c google-maps google-polyline
Form 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;
}
【讨论】: