[OpenLayers-Users] multiple layers... best performance?

pere roca ristol peroc79 at gmail.com
Fri May 8 02:54:03 EDT 2009


hi all,
on my webapp I have distributed legends where you can switch on/off
different layers. All of these layers refer to the same GeoServer.
As far as I know, I can design my webapp in two ways:
1) Just an Openlayers layer and I add/remove layers from layers parameter
when user switch on/off a layer

   layer = new OpenLayers.Layer( "OpenLayers
WMS","http://myGeoServer/wms",{layers:
layer1,layer2...}

2) create "on-the-fly" a new OpenLayers.Layer with a function when user
selects a still not visible layer:
            var add_lay=function(layerName,lay)
                                {
                         var new_lay="edit_"+layerName+" =new
OpenLayers.Layer.WMS( 'my WMS','http://myGeoserver',{layers:'topp:"+lay+"'}
);";            eval(new_lay);
                      eval("map.addLayer(edit_"+layerName+")");
                                }

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.
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.

In terms of performance, which is the best option?

thanks!
Pere Roca

-- 
Pere Roca Ristol
Biòleg i especialista GIS
Museo Nacional de Ciencias Naturales (CSIC)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090508/ea9a92da/attachment.html


More information about the Users mailing list