[OpenLayers-Dev] multiple maps and one panzoom control?

Paul Spencer pspencer at dmsolutions.ca
Thu May 8 07:12:02 EDT 2008


Dan,

a control is associated with a single map (by adding the control to  
the map) so what you want is not directly possible.  However, it would  
be easy to fake it by adding an event listener on the map that has the  
control and programmatically setting the center and zoom of the other  
map.

window.onload = function() {
     ...
     map1.events.register('moveend', null, synchronizeMaps);
     ...
}

function synchronizeMaps() {
     map2.setCenter(map1.getCenter(), map1.getZoom());
}

If you wanted some offset in zoom level or something then you could do  
that in synchronizeMaps.  If you actually want the maps to be at two  
different starting points, then you can adjust the center by the  
difference as well.

Cheers

Paul

On 8-May-08, at 3:47 AM, Darko Radiceski wrote:
> greeting all.
>
> I was interested if it possible to have multiple maps on the screen
> but one pan zoon controll?
>
> I have tried to place the navcontrol outside from the maps and
> configure it per the example the shows how to place the nav contoll
> outside the map.when I have 2 maps on the page the controll affects
> only the second map.
>
> is it possible to make that controll affect any map on the scree.so
> place one on the top of the page and that's it.
>
> any help or pointers is much apreciated.
>
> cheers
> dan
>
> -- 
> Radiceski Darko
> University of Wollongong
> Australia
> SIFE - UOW Chapter - Alumni
> CASUAL ACADEMIC STAFF TEACHING - UOW SITACS
> (School of Information Technology and Computer Science,University of  
> Wollongong)
> Univeristy of Wollongong - Alumni
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/




More information about the Dev mailing list