<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-15>
<META content="MSHTML 6.00.6002.18357" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" text=#333333
bgColor=#ffffff leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT face=Arial color=#000000 size=2><FONT face="Times New Roman"
size=3>Your map panel config should be:</FONT></FONT></DIV>
<DIV><FONT color=#000000></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2><FONT face="Times New Roman"
size=3>
xtype: 'gx_mappanel',<BR>
title:
'Maps',<BR>
split: true,<BR>
map:
mainMap,
<BR>
layers: [layerList]}</FONT></FONT></DIV>
<DIV><FONT color=#000000></FONT> </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><FONT face=Arial><FONT size=2><FONT
color=#000000></FONT></FONT></FONT> </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></DIV></FONT></FONT>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Arial color=#000000></FONT><FONT face=Arial
color=#000000></FONT><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A 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 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><FONT face=Arial color=#000000 size=2></FONT><FONT face=Arial color=#000000
size=2></FONT><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>
<HR>
<P></P>_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR></BODY></HTML>