<span class="Apple-style-span" style="border-collapse: collapse; font-family: verdana; ">hi all, <br>on my webapp I have distributed legends where you can switch on/off different layers. All of these layers refer to the same GeoServer. <br>
As far as I know, I can design my webapp in two ways: <br>1) Just an Openlayers layer and I add/remove layers from layers parameter when user switch on/off a layer <br><br> layer = new OpenLayers.Layer( "OpenLayers WMS","<a href="http://myGeoServer/wms" target="_top" rel="nofollow" style="font-size: 1em; ">http://myGeoServer/wms</a>",{layers: layer1,layer2...} <br>
<br>2) create "on-the-fly" a new OpenLayers.Layer with a function when user selects a still not visible layer: <br> var add_lay=function(layerName,lay) <br> { <br> var new_lay="edit_"+layerName+" =new OpenLayers.Layer.WMS( 'my WMS','<a href="http://myGeoserver'" target="_top" rel="nofollow" style="font-size: 1em; ">http://myGeoserver'</a>,{layers:'topp:"+lay+"'} );"; eval(new_lay);        <br>
eval("map.addLayer(edit_"+layerName+")");        <br> } <br><br>The problem of the first is that each time a layer is switched on/off or zoom in/out, a big GetMap request (what about 10 layers?) must be done and takes more time than usual. <br>
The problem of the second one is that the more layer we add on the top of an openlayer application, the more the application slow down. <br><br>In terms of performance, which is the best option? <br><br>thanks! <br>Pere Roca</span><br clear="all">
<br>-- <br>Pere Roca Ristol<br>Biòleg i especialista GIS<br>Museo Nacional de Ciencias Naturales (CSIC)<br><br>