[Users] Re-center map via an "outside"-link
Stefan Schwarzer
stefan.schwarzer at unepgrid.ch
Tue Aug 17 17:04:34 CEST 2010
Hi there,
I am trying to make available some "shortcuts" to the user, meaning that at the right side of the Mappanel, there are some names on which the user can click to zoom directly to these regions/towns.
However, I don't get how this could be implemented. I searched quite some while on the Net, but couldn't really find an answer. I guess that it's not too difficult to implement; I am just not too familiar with Javascript. What I came up so far is something like:
<a href="#" onclick="mapdiv = document.getElementById('map'); mapdiv.setCenter(6, 45); mapdiv.zoomTo(10);">.....</a>
But it (obviously) doesn't recognize the map ID, as the map only exists as an Javascript variable, right?
// create map instance
var map = new OpenLayers.Map();
// create map panel
mapPanel = new GeoExt.MapPanel({
title: "Map",
region: "center",
height: 400,
width: 600,
layout: "fit",
map: map,
center: new OpenLayers.LonLat(8.1, 46.2),
zoom: 8
});
So, what do I need to do to achieve my goal?
Thanks a lot for any hints!
Stef
More information about the Users
mailing list