我正在使用OpenLayers作为地图,当我加载它时,无论我将setCenter更改为什么,它总是以0,0为中心。
var map, baseLayer;
var options = {numZoomLevels: 7, isBaseLayer: true,};
function collegeLaneInit()
{
map = new OpenLayers.Map('map');
baseLayer = new OpenLayers.Layer.Image("College Lane","college-lane-large.png",
new OpenLayers.Bounds(-1000, -1000, 1000, 1000),
new OpenLayers.Size(2000,2000), options);
map.addLayer(baseLayer);
var center = new OpenLayers.LonLat(500,500);
map.setCenter(center ,1);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
map.addControl(new OpenLayers.Control.MousePosition());
}
我不确定为什么会这样做。有人能发现我遗失的东西吗?