[OpenLayers-Users] Moveend event results in endless loop

Dragan Podvezanec dragan.podvezanec at gmail.com
Mon Oct 12 01:58:59 EDT 2009


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?
-- 
View this message in context: http://n2.nabble.com/Moveend-event-results-in-endless-loop-tp3806298p3806298.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list