Google maps Openlayers zoomtoextent缩放到另一个位置

Google maps Openlayers zoomtoextent缩放到另一个位置,google-maps,openlayers,Google Maps,Openlayers,我试图放大一个投影为EPSG:3857的地图上的边界框。地图应该放大到这里的某个地方: 然而,用下面的代码进入非洲附近海洋的某个地方。你能告诉我怎么了吗 bounds=新的OpenLayers.bounds(); extend(新OpenLayers.LonLat(34.8660822,32.3172887)); 扩展(新OpenLayers.LonLat(34.8570271,32.2953077)); bounds.toBBOX(); map.openlayers.zoomToExtent

我试图放大一个投影为EPSG:3857的地图上的边界框。地图应该放大到这里的某个地方:

然而,用下面的代码进入非洲附近海洋的某个地方。你能告诉我怎么了吗

bounds=新的OpenLayers.bounds();
extend(新OpenLayers.LonLat(34.8660822,32.3172887));
扩展(新OpenLayers.LonLat(34.8570271,32.2953077));
bounds.toBBOX();
map.openlayers.zoomToExtent(边界);

map.openlayers.updateSize()您必须将边界从EPSG:4326(WGS84)转换为EPSG:900913(EPSG:3857)

bounds=新的OpenLayers.bounds();
extend(新OpenLayers.LonLat(34.8660822,32.3172887));
扩展(新OpenLayers.LonLat(34.8570271,32.2953077));
转换(新OpenLayers.Projection(“EPSG:4326”)、新OpenLayers.Projection(“EPSG:900913”);
map.openlayers.zoomToExtent(bounds,true);