<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#333333">
<font face="Helvetica, Arial, sans-serif">ok... when I try to add
some layers like</font><br>
<font face="Courier New, Courier, monospace">layers: ([OLwms,
USGSwms, NASAwms]) <font face="Helvetica, Arial, sans-serif">it
works fine. But using<font face="Courier New, Courier,
monospace"> layers:([layerlist])<font face="Helvetica, Arial,
sans-serif"> it doesn't work at all. The browser is empty
and firebug shows an error <br>
</font></font></font><span role="presentation"
class="objectBox objectBox-errorMessage hasBreakSwitch "><span
class="errorMessage ">map.layers is undefined</span></span></font><br>
<br>
Christian<br>
<font face="Courier New, Courier, monospace"><br>
</font><br>
Am 24.02.2011 15:16, schrieb Matt Priour:
<blockquote cite="mid:BB2BDDAF5C1C4932895C3483DCA600A8@Lenovo"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-15">
<meta content="MSHTML 6.00.6002.18357" name="GENERATOR">
<div><font size="2" color="#000000" face="Arial"><font size="3"
face="Times New Roman">Your map panel config should be:</font></font></div>
<div> </div>
<div><font size="2" color="#000000" face="Arial"><font size="3"
face="Times New Roman"> xtype:
'gx_mappanel',<br>
title: 'Maps',<br>
split: true,<br>
map: mainMap, <br>
layers: [layerList]}</font></font></div>
<div> </div>
<div><font face="Arial"><font size="2"><font color="#000000">it is
layers not layer and zoomTo is not a valid config option.
You can use zoom, center or nothing and the map will start
at maxExtent</font></font></font></div>
<div> </div>
<div><font face="Arial"><font size="2"><font color="#000000">Matt
Priour</font></font></font></div>
<div><font face="Arial"><font size="2"><font color="#000000">Kestrel
Computer Consulting</font></font></font></div>
<div style="font: 10pt Tahoma;">
<div><br>
</div>
<div style="background: none repeat scroll 0% 0% rgb(245, 245,
245);">
<div style=""><b>From:</b> <a moz-do-not-send="true"
title="christian.gadge@ufz.de"
href="mailto:christian.gadge@ufz.de">Christian Gadge</a> </div>
<div><b>Sent:</b> Thursday, February 24, 2011 7:53 AM</div>
<div><b>To:</b> <a moz-do-not-send="true"
title="users@geoext.org" href="mailto:users@geoext.org">users@geoext.org</a>
</div>
<div><b>Subject:</b> [Users] How to add array of layers /
LayerStore to map</div>
</div>
</div>
<div><br>
</div>
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 class="moz-txt-link-rfc2396E"
href="http://labs.metacarta.com/wms/vmap0"
moz-do-not-send="true">"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 class="moz-txt-link-rfc2396E"
href="http://sigma.openplans.org/geoserver/wms?"
moz-do-not-send="true">"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 class="moz-txt-link-rfc2396E"
href="http://wms.jpl.nasa.gov/wms.cgi?" moz-do-not-send="true">"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>
<p>
</p>
<hr>
_______________________________________________<br>
Users mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a><br>
<a class="moz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Christian Gadge
Department Urban and Environmental Sociology | Research Field Geomatics
Helmholtz Centre for Environmental Research - UFZ
Permoserstraße 15, 04318 Leipzig, Germany
phone +49 (0)341 - 235 1730
fax +49 (0)341 - 235 1834
email <a class="moz-txt-link-abbreviated" href="mailto:christian.gadge@ufz.de">christian.gadge@ufz.de</a>
Sitz der Gesellschaft: Leipzig | Vorsitzender des Aufsichtsrats: Wilfried Kraus
Registriergericht: Amtsgericht Leipzig | Wissenschaftlicher Geschäftsführer: Prof- Dr. Georg Teutsch
Handelsregister Nr. B4703 | Administrativer Geschäftsführer: Dr. Andreas Schmidt
<a class="moz-txt-link-freetext" href="http://www.ufz.de">http://www.ufz.de</a>
</pre>
</body>
</html>