【问题标题】:How can I calculate distance origin lat long to destination lat long of polyline points on google maps如何计算谷歌地图上折线点的起点经纬度到目的地纬度经度的距离
【发布时间】:2016-09-15 10:27:31
【问题描述】:

我想找到我使用 google api 绘制的折线的起点 lat long 和目的地 lat long 之间的距离。

【问题讨论】:

标签: ios objective-c google-maps google-polyline


【解决方案1】:

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;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-18
    • 1970-01-01
    • 2019-12-09
    • 2011-08-16
    • 2016-02-03
    • 1970-01-01
    相关资源
    最近更新 更多