<!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>first you don't need
parenthesis</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>second I mis-typed that config below.
And I mis-read what you wrote.</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>your variable layerList is a portion
of TreePanel config. You can't use that as the layers parameter in MapPanel. The
layers parameter is ONLY valid with a simple array of OpenLayers layers OR
a GeoExt.data.LayerStore</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>I was thinking that you had something
like:</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>var layerlist = [<FONT
face="Courier New" size=3>OLwms, USGSwms, NASAwms]</FONT></FONT></DIV>
<DIV><FONT face="Courier New" color=#000000>in that case the layers parameter
should read:</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>...</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>layers:layerlist</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>...</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2>layerlist is already an array so you
don't need to enclose it in [ ]. That makes it an array of an array, which is
not going to be read correctly by the MapPanel constructor</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2>Sorry for the confusion</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2>Matt Priour</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2></FONT> </DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Arial color=#000000></FONT><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 8:47 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> Re: [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><FONT face=Arial color=#000000 size=2></FONT><BR></DIV><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
class="objectBox objectBox-errorMessage hasBreakSwitch "
role="presentation"><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 content="MSHTML 6.00.6002.18357" name=GENERATOR>
<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> </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> </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><FONT face=Arial color=#000000></FONT><FONT face=Arial
color=#000000></FONT><BR></DIV>
<DIV style="BACKGROUND: rgb(245,245,245)">
<DIV><B>From:</B> <A title=christian.gadge@ufz.de
href="mailto:christian.gadge@ufz.de" moz-do-not-send="true">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"
moz-do-not-send="true">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
title="http://wms.jpl.nasa.gov/wms.cgi? CTRL + Click to follow link"
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>
<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>