在iPhone上,我以十进制度数获取用户的位置,例如:纬度39.470920和经度= -0.373192;也就是A点。
我需要用另一个 GPS 坐标(同样以十进制表示)、B 点创建一条线。然后,计算从 A 到 B 的线与另一个点 C 之间的距离(垂直)。
问题是我对度数值感到困惑。我想要以米为单位的结果。需要什么转换?计算这个的最终公式会是什么样子?
使用 - (CLLocationDistance)getDistanceFrom:(const CLLocation *)location
firstLongitude = 30.0;
firstLatitude = 30.0;
secondLongitude = 40.0;
secondLatitude = 40.0;
CLLocation *firstLoc = [[CLLocation alloc]initWithLatitude:firstLatitude longitude: firstLongitude];
CLLocation *secondLoc = [[CLLocation alloc]initWithLatitude:secondLatitude longitude: secondLongitude];
double distanceInMeters = [firstLoc getDistanceFrom: secondLoc];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)