根据经纬度求两点间距离
2013-03-05 11:12
162 查看
http://www.cnblogs.com/xionglee/articles/1493276.html
public static double DistanceOfTwoPoints(double lng1,double lat1, double lng2, double lat2, GaussSphere gs) { double radLat1 = Rad(lat1); double radLat2 = Rad(lat2); double a = radLat1 - radLat2; double b = Rad(lng1) - Rad(lng2); 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 * (gs == GaussSphere.WGS84 ? 6378137.0 : (gs == GaussSphere.Xian80 ? 6378140.0 : 6378245.0)); s = Math.Round(s * 10000) / 10000; return s; } private static double Rad(double d) { return d * Math.PI / 180.0; } GaussSphere 为自定义枚举类型 /// <summary> /// 高斯投影中所选用的参考椭球 /// </summary> public enum GaussSphere { Beijing54, Xian80, WGS84, }
相关文章推荐
- 根据两点经纬度计算距离
- 根据经纬度计算两点之间的距离
- 根据经纬度计算两点之间的距离
- 根据两点间的经纬度计算距离
- 根据两点经纬度计算距离
- Delphi 根据经纬度计算地球上两点之间的距离
- Delphi 根据经纬度计算地球上两点之间的距离
- 根据两个点的经纬度算两点间的距离——球面半正矢公式
- 根据两点经纬度计算距离
- 利用JS实现的根据经纬度计算地球上两点之间的距离
- 根据两点经纬度计算距离
- 根据两点经纬度计算精确距离,结果和百度地图测距一样——java实现
- 根据两点经纬度计算两点距离...工具类
- 根据两点经纬度获取实际距离
- 根据经纬度计算地球表面两点间的距离
- PHP开发小技巧①③—PHP根据两点间的经纬度计算距离
- 经纬度知识-来源,计算,根据两点经纬度计算距离
- IOS根据两点的经纬度计算两点之间的距离
- 怎么根据经维度计算两点之间的距离,怎么根据经纬度与距离计算目标地点的经纬度
- 根据两点经纬度计算距离