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

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

作者: 贝勒老爷 | 来源:发表于2020-05-12 14:15 被阅读0次

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

-(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/uaebnhtx.html