[OpenLayers-Users] Problem adding layers

Raul David Orozco hagen1113 at yahoo.com
Fri Jul 31 12:14:03 EDT 2009


Hi. I'm having a little problem, I hope anyone can help me.

I make a GetCapabilities request to my wms server to determine the layers the server can offer me, using it's response I take the xml of the server's response to make the new OpenLayers.Layer.WMS call. Now here's my problem, later when I add the the layers to the map all the layers are created as base layers, but I need one layer to be the base layers and the others as overlays. How can I do that?. Here's my code:

var request = OpenLayers.Request.GET(
            {url: "http://192.168.1.5:9090/smms/wms.php?VERSION=1.1.1&REQUEST=GetCapabilities&SERVICE=WMS",
            success: function(response){
                            var XMLformat = new OpenLayers.Format.XML();
                            var xml = XMLformat.read(response.responseText);
                            var CAPformat = new OpenLayers.Format.WMSCapabilities();
                            var cap = CAPformat.read(xml);
                            
                            for (var i=0; i<cap.capability.layers.length; i++) {
                                layer = cap.capability.layers[i];
                                layers_array[i] = new OpenLayers.Layer.WMS( layer.name,
                                                "http://192.168.1.5:9090/smms/wms.php",
                                            { 
                                              layers: layer.name, format: "image/png"}
                                            );
                                map.addLayer(layers_array[i]);
                            }
                                },
                failure: function(response){
                            alert(response.status);
                            alert("GetCapabilities failed");
                                }
            }); 

The base layer or overlay attribute for a layer how's is determinated by OL?

And other question, I'm getting a bounds is null error, where are the bounds defined? In the call to OL, or in the info of the layer delivered by the WMS server. Thanx a lot for any help.



      ____________________________________________________________________________________
¡Obtén la mejor experiencia en la web!
Descarga gratis el nuevo Internet Explorer 8. 
http://downloads.yahoo.com/ieak8/?l=e1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090731/23ee61f4/attachment.html


More information about the Users mailing list