[OpenLayers-Users] SOLVED: How do I do side by side maps the
nav in sync?
Stephen Woodbridge
woodbri at swoodbridge.com
Fri Jul 6 07:54:09 EDT 2007
Stephen Woodbridge wrote:
> Hi,
>
> I thought there was an example for this, but I can't find it.
> I need to generate a page with two OL maps that are side by side each
> serving different data, but I need them to navigate in sync. I can live
> with only one map having navigation controls, so there is a master/slave
> relationship if that simplifies things. Is there a demo example for
> this? Is anyone doing this? Can you send me a link?
Thanks to az2a on IRC and some reading of the code, lead to this solution:
map.events.register('moveend', map, function() {
map2.setCenter(this.getExtent().getCenterLonLat(),
this.getZoomForResolution(map.getResolution()));
});
map.events.register('zoomend', map, function() {
map2.setCenter(this.getExtent().getCenterLonLat(),
this.getZoomForResolution(map.getResolution()));
});
I created map and map2 objects, with map having all the nav controls and
map2 being a slave that is synced to map.
-Steve
More information about the Users
mailing list