<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello all,<br>
<div class="moz-forward-container"><span
style="mso-ansi-language:EN-GB" lang="EN-GB"><br>
I have an application developed with Ext / GeoExt / OpenLayers,
and two OpenLayers maps (within two different tabs). The zooms
and centers of these two maps objects are synchronised with
listeners.<o:p></o:p></span> <br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">My first map is
the main map, with all the layers, gathered in a GeoExt
layertree : base layers, WMS, WFS... The second map object has
only a base layer (for now). These two maps aren't displayed at
the same time side by side, but only the first or the second
map; depending on the active tab (Ext TabPanel).<o:p></o:p></span>
<br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">When displaying
map2, I try to clone a WFS layer from map1, and add it to this
new map. If the WFS layer is visible in map1 while changing the
tab, the clone() function creates a new layer which will always
be visible (I haven't any LayerTree for map2). If I go back to
map1 and deactivate the WFS layer, the clone layer is still
visible in map2. But that's not what I want…<o:p></o:p></span> <br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">If I get it
right, the clone() function creates a second layer with the same
configuration, the same features, etc, than the original layer
when cloning. So the number of features is doubled.<o:p></o:p></span>
<br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB"><o:p></o:p></span><br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">The second test
I made is adding to map2 the existing WFS layer with:<o:p></o:p></span>
<br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB"><o:p></o:p></span><br>
<i><span style="mso-ansi-language:EN-GB" lang="EN-GB">tab.map.addLayers([_vess_wfs]);<o:p></o:p></span>
</i><br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB"><o:p></o:p></span><br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">rather than…<o:p></o:p></span>
<br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB"><o:p></o:p></span><br>
<i><span style="mso-ansi-language:EN-GB" lang="EN-GB">tab.map.addLayers([_vess_wfs.clone()]);<o:p></o:p></span>
</i><br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB"><o:p></o:p></span><br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">With this code,
map2 doesn't display this layer, but Firebug says that map2 has
the layer...<o:p></o:p></span> <br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB"><o:p></o:p></span><br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">What I want is
that my two maps use the same layer, so that the feature number
isn't doubled within my web browser, and the layer's attributes
are the same in both maps (visibility, filter, etc...). Does
OpenLayers offers some functionalities to do so? Can I create
two maps with common layer objects, without doubling the weight
of it?<o:p></o:p></span> <br>
<span style="mso-ansi-language:EN-GB" lang="EN-GB">I thank you for
your advice!<o:p></o:p></span> <br>
<br>
Gabriel<o:p></o:p><br>
</div>
</body>
</html>