美文网首页
IOS 计算两个经纬度之间的距离

IOS 计算两个经纬度之间的距离

作者: seonhiu | 来源:发表于2016-07-27 09:38 被阅读53次

    IOS中计算两个经纬度之间的距离:

    -(double)distanceBetweenOrderBy:(double) lat1 :(double) lat2 :(double) lng1 :(double) lng2{
    
               CLLocation *curLocation = [[CLLocation alloc] initWithLatitude:lat1 longitude:lng1];
               CLLocation *otherLocation = [[CLLocation alloc] initWithLatitude:lat2 longitude:lng2];
    
                double  distance  = [curLocation distanceFromLocation:otherLocation];
                return  distance;
    }
    

    相关文章

      网友评论

          本文标题:IOS 计算两个经纬度之间的距离

          本文链接:https://www.haomeiwen.com/subject/iprojttx.html