[OpenLayers-Users] zooming programmatically

Tim Schaub tschaub at opengeo.org
Fri Feb 20 19:46:28 EST 2009


Hey-

Try this.

1) Open 
http://openlayers.org/dev/examples/sundials-spherical-mercator.html in 
Firefox.
2) Install Firebug, enable the console, and open it.
3) Type "map.zoomTo(6)"

I see the map zoom.  If you cannot do the same with your map, sending a 
message with a link to your page would help in debugging.

Tim

goliah wrote:
> Dear list,
> 
> a simple topic but i simply cannot get out... 
> 
> i have a map with a google maps base layer, and a gml or kml layers as
> overlays.
> I'd like to programmatically zoom with js
> I've tried
> 
> map.zoomTo(zoomlevel);
> 
> where zoomlevel is the desired zoom level.
> The result is that overlay is modified in size, but base layer just doesn't
> zoom.
> 
> Zooming and panning with mousewheel or OL zoom control works just fine.
> 
> What am I missing?
> 
> cheers 
> Mauro


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list