<!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">
Thank you Matt. This works.<br>
Yes, I tried to use the TreePanel layers to be "added" to map. I
have checkboxes for all layers.<br>
Using an array of all available layers, all these layers are now
visible within the map. But there should be only one layer visible
at time.<br>
<br>
So in that case I have to define a GeoExt.data.LayerStore of
"checked" layers to be drawn in map? Can this be done automatically?
Now all layers are visible and I have to uncheck them first.<br>
<br>
regards,<br>
Christian<br>
<br>
Am 24.02.2011 16:16, schrieb Matt Priour:
<blockquote cite="mid:60776E50E3654300973FD3CDE88FE970@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">first you don't
need parenthesis</font></div>
<div><font size="2" color="#000000" face="Arial">second I
mis-typed that config below. And I mis-read what you wrote.</font></div>
<div><font size="2" color="#000000" face="Arial">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 size="2" color="#000000" face="Arial">I was thinking
that you had something like:</font></div>
<div><font size="2" color="#000000" face="Arial">var layerlist = [<font
size="3" face="Courier New">OLwms, USGSwms, NASAwms]</font></font></div>
<div><font color="#000000" face="Courier New">in that case the
layers parameter should read:</font></div>
<div><font size="2" color="#000000" face="Arial">...</font></div>
<div><font size="2" color="#000000" face="Arial">layers:layerlist</font></div>
<div><font size="2" color="#000000" face="Arial">...</font></div>
<div> </div>
<div><font size="2" color="#000000" face="Arial">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> </div>
<div><font size="2" color="#000000" face="Arial">Sorry for the
confusion</font></div>
<div> </div>
<div><font size="2" color="#000000" face="Arial">Matt Priour</font></div>
<div> </div>
<div> </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 8:47 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> Re: [Users] How to add array of layers /
LayerStore to map</div>
</div>
</div>
<div><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 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><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><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>
<hr> _______________________________________________<br>
Users mailing list<br>
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:Users@geoext.org">Users@geoext.org</a><br>
<a moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.ufz.de">http://www.ufz.de</a>
</pre>
<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>