取两个地图坐标之间的距离
2011-12-07 08:59
260 查看
/***** * 取两坐标之间的距离 *****/ public class GetDistance { private static double EARTH_RADIUS = 6378.137;//地球半径 private static double rad(double d) { return d * Math.PI / 180.0; } public static double getDistance(double lat1, double lng1, double lat2, double lng2) { 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 * EARTH_RADIUS; s = Math.round(s * 10000*1000) / 10000;//米 return s; } }
相关文章推荐
- SQL 关于地图两个坐标点之间的距离运算
- php中使用地图的两个坐标之间的距离
- 根据地图上的两个点各自的x,y坐标,计算出2点之间的直线距离。显示为公里、米
- 地图上(百度地图)获取两个坐标之间的直线距离
- 计算地球上两个坐标点(经度,纬度)之间距离sql函数
- PHP MYSQL 搜索周边坐标,并计算两个点之间的距离
- 高德地图计算两坐标之间距离
- 传入两个中文地点,解析成坐标点,并且在地图上显示出它们之间的路线图
- 计算两个经纬度坐标之间的距离
- 计算两个GPS经纬度坐标之间的距离 PHP
- 高德地图计算两坐标之间距离
- 此小程序用于输入两个坐标,输出他们之间的距离
- Lua 计算两个GPS坐标点之间的距离
- 在百度地图API开发中已知两个点之间的经纬度坐标计算其距离
- 此小程序用于输入两个坐标,输出他们之间的距离
- 通过gps给定的两个经纬度坐标,计算两点之间的距离
- 使用iOS原生类计算两个坐标点之间的距离
- 计算两个坐标点之间的距离
- 计算地图上两坐标点之间的距离
- 计算两个坐标之间的距离(米)