iOS根据2个经纬度计算距离
来源:互联网 发布:第三次农业普查数据 编辑:程序博客网 时间:2024/06/05 05:45
#pragma mark - calculate distance 根据2个经纬度计算距离#define PI 3.14159265358979323+(double) CalculationDistanceOther_Lon1:(double)lon1 Other_Lat1:(double)lat1 self_Lon2:(double)lon2 self_Lat2:(double)lat2{ double er = 6371229; // 6378700.0f; //ave. radius = 6371.315 (someone said more accurate is 6366.707) //equatorial radius = 6378.388 //nautical mile = 1.15078 double radlat1 = PI*lat1/180.0f; double radlat2 = PI*lat2/180.0f; //now long. double radlong1 = PI*lon1/180.0f; double radlong2 = PI*lon2/180.0f; if( radlat1 < 0 ) radlat1 = PI/2 + fabs(radlat1);// south if( radlat1 > 0 ) radlat1 = PI/2 - fabs(radlat1);// north if( radlong1 < 0 ) radlong1 = PI*2 - fabs(radlong1);//west if( radlat2 < 0 ) radlat2 = PI/2 + fabs(radlat2);// south if( radlat2 > 0 ) radlat2 = PI/2 - fabs(radlat2);// north if( radlong2 < 0 ) radlong2 = PI*2 - fabs(radlong2);// west //spherical coordinates x=r*cos(ag)sin(at), y=r*sin(ag)*sin(at), z=r*cos(at) //zero ag is up so reverse lat double x1 = er * cos(radlong1) * sin(radlat1); double y1 = er * sin(radlong1) * sin(radlat1); double z1 = er * cos(radlat1); double x2 = er * cos(radlong2) * sin(radlat2); double y2 = er * sin(radlong2) * sin(radlat2); double z2 = er * cos(radlat2); double d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2)); //side, side, side, law of cosines and arccos double theta = acos((er*er+er*er-d*d)/(2*er*er)); double dist = theta*er; return dist;}
0 0
- iOS根据2个经纬度计算距离
- IOS根据两个经纬度计算相距距离
- IOS根据两个经纬度计算相距距离
- ios 根据两个经纬度计算距离
- iOS根据两个经纬度计算相距距离
- IOS根据两个经纬度计算相距距离
- IOS根据两个经纬度计算相距距离
- 根据经纬度计算距离
- 根据经纬度计算距离
- 根据经纬度计算距离
- 根据经纬度计算距离
- 根据2个经纬度点,计算这2个经纬度点之间的距离(通过经度纬度得到距离)
- 根据2个经纬度点,计算这2个经纬度点之间的距离(通过经度纬度得到距离)
- 根据2个经纬度点,计算这2个经纬度点之间的距离(通过经度纬度得到距离)
- 根据两点经纬度计算距离
- 根据两点经纬度计算距离
- 根据经纬度坐标计算距离
- 根据经纬度计算球面距离
- (4.5.1.3)Import project(Eclipse ADT, Gradle, etc.)
- java设计模式——行为型之命令模式
- iOS Core Graphics 和 Core Animation
- mysql 的行转列
- Ubuntu中文语言包的安装
- iOS根据2个经纬度计算距离
- sunjce iOS des 3des解密加密
- Javaweb开发错误关于web.xml
- (4.5.1.4)Import Project(Eclipse ADT, Gradle,etc)(包括导入第三方Project项目(不是jar包形式))
- mysql dump备份方式 mysql还原操作练习
- FOJ Problem 1081 等分液体
- 摘抄:项目经理需知道的16件事
- git 常用命令
- 欧拉项目第15题 Lattice paths