[OpenLayers-Users] Moveend event results in endless loop

Alexandre Dube adube at mapgears.com
Tue Oct 13 09:03:14 EDT 2009


Hi Dragan,

Using firebug and putting a breakpoint to your map.zoomToExtent(bbox), 
what does it looks like ?

Alexandre

Dragan Podvezanec wrote:
> Hi all. I have small problem with moveend event: I have two layers, WMS (as
> base layer), and WFS. Both are served by Geoserver. What I want to do is:
> after searching for an object from WFS layer, I want to Pan the map to
> center of this object, and then zoom to it's extents. Here is the part of
> the code:
>
> wfs.events.register("loadend", wfs, function() {
> 			var bbox = wfs.getDataExtent();
> 			map.panTo(bbox.getCenterLonLat());
> 			alert("Centered");
> 				wms.events.register("moveend", wms, function() 
> 				{
> 					alert(bbox);
> 					//map.zoomToExtent(bbox);
> 					
> 				});
> 				
> 			});
>
> As you see, zoomToExtent is commented. This way map pans to center of the
> WFS object and I have the alert with bbox. But, if I uncomment
> map.zoomToExtent(bbox); , I keep getting this alert with bbox, and map never
> zooms to bbox. What am I doing wrong here?
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list