[OpenLayers-Users] Zooming to an extend via link outside map viewport

Max Stephan x.zam at gmx.net
Sun Mar 22 09:58:20 EDT 2009


Hey everybody,

I want to place a link outside the map which zooms to a specified extent
(something like "javascript: map.zoomToExtent(new
OpenLayers.Bounds(1,2,3,4))" as a link in the body). But it´s logically not
that easy because I have to get access to the map-variable that is
unfortunately in the init-function.

So I tried several things. For example I defined a function named "zoom"
which contains "map.zoomToExtent(1,2,3,4);" in it´s body but that´s not
working at all. The only way that worked was to empty the map-div-container
via "document.getElementById('map').innerHTML="";" and to run the function
init with the new bounds as a parameter afterwards.

Does anyone know a more elegant way than reloading the complete
init-function?

Thx in advance
Max Stephan
-- 
View this message in context: http://n2.nabble.com/Zooming-to-an-extend-via-link-outside-map-viewport-tp2517040p2517040.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list