当前位置:网站首页>Baidu map coordinates, Google coordinates and Tencent coordinates are mutually transformed
Baidu map coordinates, Google coordinates and Tencent coordinates are mutually transformed
2022-04-23 06:52:00 【Collect and study by yourself】
<?php
// China Normal GCJ02 coordinate ----> Baidu Maps BD09 coordinate
function Convert_GCJ02_To_BD09($lat,$lng){
$x_pi = 3.14159265358979324 * 3000.0 / 180.0;
$x = $lng;
$y = $lat;
$z =sqrt($x * $x + $y * $y) + 0.00002 * sin($y * $x_pi);
$theta = atan2($y, $x) + 0.000003 * cos($x * $x_pi);
$lng = $z * cos($theta) + 0.0065;
$lat = $z * sin($theta) + 0.006;
return array('lng'=>$lng,'lat'=>$lat);
}
// Baidu Maps BD09 coordinate ----> China Normal GCJ02 coordinate
// Tencent maps also use GCJ02 coordinate
function Convert_BD09_To_GCJ02($lat,$lng){
$x_pi = 3.14159265358979324 * 3000.0 / 180.0;
$x = $lng - 0.0065;
$y = $lat - 0.006;
$z = sqrt($x * $x + $y * $y) - 0.00002 * sin($y * $x_pi);
$theta = atan2($y, $x) - 0.000003 * cos($x * $x_pi);
$lng = $z * cos($theta);
$lat = $z * sin($theta);
return array('lng'=>$lng,'lat'=>$lat);
}
?>
版权声明
本文为[Collect and study by yourself]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230555552175.html
边栏推荐
猜你喜欢
随机推荐
Router对象、Route对象、声明式导航、编程式导航
1-4 NodeJS的安装之配置可执行脚本
mysql中sum (if)_mysql 中sum (if())
Set and map
excel里有文字的数字怎么从小到大排序,而不是首数字排序
如何使用input表单向服务发送(占用较小)图片文件(body传输)?涉及到FileReader内置对象
Thinkphp5 -- object (think \ response \ JSON) to array
Database programming of node
【正河源刀具相关】
js中的作用域与作用域链
JS实现网页轮播图
C# webpai 路由详解
Parse PSD files and map them into components
自用学习笔记-connectingString配置
1-2 NodeJS的特点
数据可视化百度地图进一步优化
Offset et client pour obtenir des informations sur l'emplacement des éléments Dom
百度地图坐标、Google坐标、腾讯坐标相互转化
ASP.NET CORE 配置选项(上篇)
Analysis of fixed point PID code of FOC motor Library









