[OpenLayers-Users] Re: Synchronize position and zoom of two maps

canduc17 candini at meeo.it
Tue Dec 20 09:07:31 EST 2011


I have tryed with the following:

var c1, c2, z1, z2;
map1.events.register("moveend", map1, function() { 
	c1 = this.getCenter();
	z1 = this.getZoom();
	map2.panTo(c1);
	map2.zoomTo(z1);
});
map2.events.register("moveend", map2, function() { 
	c2 = this.getCenter();
	z2 = this.getZoom();
	map1.panTo(c2);
	map1.zoomTo(z2);
});

It seems to work but from time to time maps get frozen and firebug (firefox
plugin) reports me the error "too much recursion".
If I comment out map2 related event I have no problems, but the
synchronization is only if I pan/zoom map1 and I would like to make it
possible also for map2.

Any ideas on how to solve this?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Synchronize-position-and-zoom-of-two-maps-tp7107428p7111860.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list