[Cartoweb-users] Re: Synchronizing two map extents

Oliver Christen oliver.christen at camptocamp.com
Tue May 13 02:24:53 EDT 2008


Hi

there are several operation that can be triggered via the url, see for the 
list: 
http://www.cartoweb.org/doc_head/docbook/xhtml/dev.newplugin.html#dev.newplugin.special.filters
in your case, using a recenter_bbox=minx,miny,maxx,maxy in the url will 
recenter the map within the selected bbox

to implement it in your application, simply use some javascript to do a 
location.href = ...?recenter_bbox=... on the second iframe.
You can recover the bbox easily with $('selection_coords').value in the 
first iframe.
And you can trigger the action, for example, in the function 
AjaxPlugins.Location.Actions.Zoom (Location.ajax.js)

to override cleanly a function in any Cartoweb javscript, simply create a 
new .js
file and write inside:
AjaxPlugins.Location.Actions.Zoom = function() {
..
}
and include that at the end of the <head> in your Cartoclient.tpl, the idea 
is the file get included AFTER the file containing the unmodified original 
code and the function will be effectively overriden.

regards
Oliver


----- Original Message ----- 
From: Justin Ngan
To: 'Oliver Christen'
Sent: Tuesday, May 13, 2008 2:18 AM
Subject: Synchronizing two map extents


Hi Oliver,

I have two maps displayed on one web page in two iFrames. Each iFrame is 
named and the form of each map also has a unique name. Is there a simple way 
that you can suggest for synchronizing the shown extent for the two maps. 
For example, if I zoom to an area on map one, I would like map 2 to 
automatically refresh to the same extent.

Many thanks
Justins 



More information about the Cartoweb-users mailing list