[OpenLayers-Users] zooming programmatically

goliah bianchimro at gmail.com
Mon Feb 23 04:09:39 EST 2009


Hi Tim

current situation is the following: if I execute map.zoomTo via console
everything seems ok, but if i put it in the code only the overlay size
changes and i get no zoom. Moreover, my overlay gets broken on panning (it
gets displaced).

I tried both putting map.zoomTo after executing map.addLayer(overlay) and
into 'loadend' event for the overlay, but it does not work.

my app is located at
www.maurob.org/webrsa/

an exaple of broken zoom can be reached by clicking on the first button
top-left ("Contesto di riferimento") and then on the second button in the
second row ("Territorio")

regards
Mauro




Tim Schaub wrote:
> 
> 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.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/zooming-programmatically-tp2361965p2371181.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list