//百度转腾讯坐标转换
function coordinate_b2t($a,$b){
$x = (double)$b - 0.0065;
$y = (double)$a - 0.006;
$x_pi = 3.14159265358979324;
$z = sqrt($x * $x+$y * $y) - 0.00002 * sin($y * $x_pi);
$theta = atan2($y,$x) - 0.000003 * cos($x*$x_pi);
$gb = number_format($z * cos($theta),15);
$ga = number_format($z * sin($theta),15);
return ['lat'=>$ga,'lon'=>$gb];
}
//腾讯转百度坐标转换
function coordinate_t2b($a,$b){
$x = (double)$b ;
$y = (double)$a;
$x_pi = 3.14159265358979324;
$z = sqrt($x * $x+$y * $y) + 0.00002 * sin($y * $x_pi);
$theta = atan2($y,$x) + 0.000003 * cos($x*$x_pi);
$gb = number_format($z * cos($theta) + 0.0065,6);
$ga = number_format($z * sin($theta) + 0.006,6);
return ['lat'=>$ga,'lon'=>$gb];
}
专注于网站开发、H5网站开发。美观、快速、稳定、安全是我们不懈的追求。
版权所有 2018 顺道电子商务有限公司