百度坐标系 转 国测局坐标系
function bd09_To_Gcj02($bd_lon, $bd_lat)
{
$bd_lon = trim($bd_lon);
$bd_lat = trim($bd_lat);
$x = $bd_lon - 0.0065;
$y = $bd_lat - 0.006;
$z = sqrt($x * $x + $y * $y) - 0.00002 * sin($y * pi());
$theta = atan2($y, $x) - 0.000003 * cos($x * pi());
$gg_lon = $z * cos($theta);
$gg_lat = $z * sin($theta);
return array($gg_lon, $gg_lat);
}
国测局坐标系 转 百度坐标系
function gcj02_To_Bd09($gg_lon, $gg_lat)
{
$x = trim($gg_lon);
$y = trim($gg_lat);
$z = sqrt($x * $x + $y * $y) + 0.00002 * sin($y * pi());
$theta = atan2($y, $x) + 0.000003 * cos($x * pi());
$bd_lon = $z * cos($theta) + 0.0065;
$bd_lat = $z * sin($theta) + 0.006;
return array($bd_lon, $bd_lat);
}
扩展
开发者 | WGS84、GCJ-02、BD-09都是什么鬼?
https://www.jianshu.com/p/559029832a67