[OpenLayers-Users] setCenter problem
Tyler Durden
tylersticky at gmail.com
Thu Aug 2 11:21:31 EDT 2007
Hi,
I have list of links:
Example:
<a href="#" onclick="map.setCenter(new OpenLayers.LonLat(16.0, 41.0),
8);">show</a>
But nothing happens.
setCenter() only applies on init()?
var lon = -8.61057;
var lat = 41.14452;
var zoom = 8;
var bounds = new OpenLayers.Bounds(-11.535, 36.095, -4.535, 43.095);
var map, layer_continente;
function initMap() {
var options = { maxResolution : 0.015693359375,
numZoomLevels : 12,
maxExtent : bounds,
projection : "EPSG:4326"}
map1 = new OpenLayers.Map('map', options);
layer_continente = new OpenLayers.Layer.WMS("continente",
"http://localhost:8080/", {"layers":"continente",
"format":"image/png"})
map.addLayer(layer_continente);
map.addControl(new OpenLayers.Control.PanZoom());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.MouseDefaults());
map.addControl(new OpenLayers.Control.Permalink());
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
More information about the Users
mailing list