<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-15">
</head>
<body bgcolor="#ffffff" text="#333333">
Hello all,<br>
<br>
I tried to add an array of layers to my map object but it fails.
First I have created some layers and added these to a layerlist
(=array) which is also used for a layer tree. How can I add this
array to the map? Do I have to create a GeoExt.data.layerStore?<br>
Thank you for some sugestions...<br>
<br>
Here the relevant code:<br>
<br>
/*<br>
* Layer<br>
*/<br>
var OLwms = new OpenLayers.Layer.WMS(<br>
"Topographic map",<br>
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://labs.metacarta.com/wms/vmap0">"http://labs.metacarta.com/wms/vmap0"</a>,
<br>
{layers: 'basic'},<br>
{isBaseLayer: true}<br>
);<br>
<br>
var BMwms = new OpenLayers.Layer.WMS(<br>
"Blue Marble Global Imagery",<br>
<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://sigma.openplans.org/geoserver/wms?">"http://sigma.openplans.org/geoserver/wms?"</a>,<br>
{layers: 'bluemarble'},<br>
{isBaseLayer: true }<br>
);<br>
<br>
var NASAwms = new OpenLayers.Layer.WMS( <br>
"NASA WMS",<br>
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://wms.jpl.nasa.gov/wms.cgi?">"http://wms.jpl.nasa.gov/wms.cgi?"</a>,
<br>
{layers: 'BMNG', format: 'image/png'},<br>
{isBaseLayer: true}<br>
);<br>
...<br>
<br>
/*<br>
* Array with layers<br>
*/<br>
<br>
var layerList =[{ <br>
text: 'Background Layers',<br>
leaf: false, <br>
expanded: true,<br>
children: [{<br>
nodeType: 'gx_layer',<br>
layer: OLwms,<br>
checked: false<br>
}, {<br>
nodeType: 'gx_layer',<br>
layer: BMwms,<br>
checked: false<br>
}, {<br>
nodeType: 'gx_layer',<br>
layer: NASAwms,<br>
checked: false<br>
},<br>
...<br>
]<br>
}];<br>
...<br>
<br>
/*<br>
* the map panel<br>
*/<br>
<br>
var mainPanel = new Ext.Panel({<br>
region: 'center',<br>
deferredRender: false,<br>
margins: '5 5 5 5', <br>
activeTab: 2, <br>
items:[<br>
{<br>
xtype: 'gx_mappanel',<br>
title: 'Maps',<br>
split: true,<br>
map: mainMap, <br>
layer: ([layerList]),<br>
zoomTo: 'maxExtent',<br>
}]<br>
}); <br>
<br>
<br>
<br>
Best regards,<br>
Christian<br>
<br>
</body>
</html>