高德地图坐标与百度地图坐标相互转换
程序员文章站
2022-04-05 10:07:12
来自:https://blog.csdn.net/wang415229224ye/article/details/79207791 侵删//百度坐标转高德(传入经度、纬度) function bd_decrypt(bd_lng, bd_lat) { var X_PI = Math.PI * 3000... ......
来自:https://blog.csdn.net/wang415229224ye/article/details/79207791 侵删
//百度坐标转高德(传入经度、纬度) function bd_decrypt(bd_lng, bd_lat) { var x_pi = math.pi * 3000.0 / 180.0; var x = bd_lng - 0.0065; var y = bd_lat - 0.006; var z = math.sqrt(x * x + y * y) - 0.00002 * math.sin(y * x_pi); var theta = math.atan2(y, x) - 0.000003 * math.cos(x * x_pi); var gg_lng = z * math.cos(theta); var gg_lat = z * math.sin(theta); return {lng: gg_lng, lat: gg_lat} } //高德坐标转百度(传入经度、纬度) function bd_encrypt(gg_lng, gg_lat) { var x_pi = math.pi * 3000.0 / 180.0; var x = gg_lng, y = gg_lat; var z = math.sqrt(x * x + y * y) + 0.00002 * math.sin(y * x_pi); var theta = math.atan2(y, x) + 0.000003 * math.cos(x * x_pi); var bd_lng = z * math.cos(theta) + 0.0065; var bd_lat = z * math.sin(theta) + 0.006; return { bd_lat: bd_lat, bd_lng: bd_lng }; }
上一篇: python之锁, 队列
下一篇: 微博调整转发评论数据上限一百万