移动Google地图中心

bob*_*ell 2 google-maps

我需要加载Google地图,因此标记偏离中心,换句话说,地图的中心不在中心,而是向右移动.我希望这是有道理的.

这是我正在使用的脚本.

function setCenterCoords($lon,$lat) {
    $this->centerLatitude = (float) $lat;
    $this->centerLongitude = (float) $lon;
}
Run Code Online (Sandbox Code Playgroud)

我如何制作它以使中心出现在页面右侧2/3而不是页面中间?谢谢

Eri*_*ips 6

使用方法setCenter(latlng)根据需要使地图居中.