On Friday, July 31, 2009, Raul David Orozco <[email protected]> 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?.
Hi. Do you really need a base layer? I'd recommend looking at passing
allOverlays:true to the map constructor so that all layers are treated
equally, as overlays.
Cheers,
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.
>
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users