I'm working with MapServer/Postgis using OpenLayers to display map! I'm trying setCenter map but it not working! My code:
var bounds = new OpenLayers.Bounds(107.567139, 12.326586, 108.258591,
12.890796);
var options = {
controls : [],
maxExtent : bounds,
maxResolution : 0.0010217594533836,
projection : "EPSG:4326",
units : 'degrees',
allOverlays : true
};
map = new OpenLayers.Map('map', options);
.....
//Declare some layers wms
.....
map.addLayer(wms_RanhGioi);
map.addLayer(wms_GiaoThong);
map.addLayer(wms_ATM);
map.addLayer(wms_Cafe);
map.addLayer(wms_KhachSan);
map.addLayer(wms_NhaHang);
map.addLayer(wms_TramXang);
map.addControl(new OpenLayers.Control.LayerSwitcher({
'ascending' : false
}));
map.addControl(new OpenLayers.Control.PanZoomBar({
position : new OpenLayers.Pixel(2, 15)
}));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({
element : $('location')
}));
map.zoomToExtent(bounds);
map.setCenter(new OpenLayers.LonLat(12.67812, 108.04401), 5);
Somebody can help me! Thanks!!!