[OpenLayers-Users] Problem adding layers

Christopher Schmidt crschmidt at metacarta.com
Fri Jul 31 15:45:51 EDT 2009


On Fri, Jul 31, 2009 at 09:14:03AM -0700, Raul David Orozco wrote:
> 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:

"Whether a layer is a base layer or not is determined by the isBaseLayer property on the layer. Most raster layers have the isBaseLayer property set to true by default. It can be changed in the layer options." 

 -- http://docs.openlayers.org/library/layers.html

> 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
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list