计算两点经纬度之间的算法
2012-03-05 16:37
295 查看
private static final double EARTH_RADIUS = 6378.137; private static double rad(double d) { return d * Math.PI / 180.0; } /** * 得出两个经纬度之间的距离 * * @param r_longitude * @param r_latitude * @param n_longitude * @param n_latitude * @return 距离 */ public static double getDistanceByLanLon(double r_longitude, double r_latitude, double n_longitude, double n_latitude) { double radLat1 = rad(r_latitude); double radLat2 = rad(n_latitude); double a = radLat1 - radLat2; double b = rad(r_longitude) - rad(n_longitude); double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))); s = s * EARTH_RADIUS; s = Math.round(s * 10000) / 10000; return s; }
相关文章推荐
- 利用JS实现的根据经纬度计算地球上两点之间的距离
- mysql 下 计算 两点 经纬度 之间的距离
- 根据经纬度计算两点之间的距离的公式推导过程以及google.maps的测距函数
- js计算两点之间的经纬度
- 计算经纬度两点之间的距离(c#)
- 根据经纬度计算地球上两点之间的距离js实现代码
- mysql 下 计算 两点 经纬度 之间的距离 含具体sql语句
- mysql函数根据经纬度,计算地球上两点之间的距离
- 计算两点经纬度之间的距离
- java通过经纬度计算两个点的之间的距离的算法
- sqlserver 根据经纬度计算两点之间距离
- 根据经纬度计算两点之间的距离
- Java根据两点的经纬度来计算之间的距离
- mysql 下 计算 两点 经纬度 之间的距离 含具体sql语句
- 怎么根据经维度计算两点之间的距离,怎么根据经纬度与距离计算目标地点的经纬度
- mysql 下 计算 两点 经纬度 之间的距离
- 两点之间经纬度的计算
- mysql 下 计算 两点 经纬度 之间的距离 含具体sql语句
- 利用两点的经纬度来计算这两点之间的距离
- 根据经纬度计算地球上两点之间的距离js实现代码