GetDistance:function(lat1, lng1, lat2, lng2, len_type = 2, decimal = 2) { var radLat1 = lat1 * Math.PI / 180.0; //PI()圆周率 var radLat2 = lat2 * Math.PI / 180.0; var a = radLat1 - radLat2; var b = (lng1 * Math.PI / 180.0) - (lng2 * Math.PI / 180.0); var 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 * 6378.137; s = Math.round(s * 1000); if (len_type --> 1) { s /= 1000; } return Math.round(s, decimal); },
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com