//GCJ-02(火星,高德)坐标转换成BD-09(百度)坐标
//@param $longitude 高德经度
//@param $latitude 高德纬度
function bdEncrypt($longitude,$latitude){
$x_pi = 3.14159265358979324 * 3000.0 / 180.0;
$x = $longitude;
$y = $latitude ;
$z = sqrt($x * $x + $y * $y) - 0.00002 * sin($y * $x_pi);
$theta = atan2($y, $x) - 0.000003 * cos($x * $x_pi);
$longitude = $z * cos($theta) + 0.0065;
$latitude = $z * sin($theta) + 0.0065;
// 保留小数点后六位
$data['longitude'] = round($longitude, 6);
$data['latitude'] = round($latitude, 6);
return $data;
}
php高德转百度坐标
猜你喜欢
转载自blog.csdn.net/qq_26875961/article/details/125216758
今日推荐
周排行