first you don't need parenthesis
second I mis-typed that config below. And I mis-read what you wrote.
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
I was thinking that you had something like:
var layerlist = [OLwms, USGSwms, NASAwms]
in that case the layers parameter should read:
...
layers:layerlist
...

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

Sorry for the confusion

Matt Priour




From: Christian Gadge 
Sent: Thursday, February 24, 2011 8:47 AM
To: [email protected] 
Subject: Re: [Users] How to add array of layers / LayerStore to map


ok... when I try to add some layers like
layers: ([OLwms, USGSwms, NASAwms]) it works fine. But using 
layers:([layerlist]) it doesn't work at all. The browser is empty and firebug 
shows an error 
map.layers is undefined

Christian


Am 24.02.2011 15:16, schrieb Matt Priour: 
  Your map panel config should be:

                  xtype:    'gx_mappanel',
                  title:    'Maps',
                  split:     true,
                  map:    mainMap,                
                  layers: [layerList]}

  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

  Matt Priour
  Kestrel Computer Consulting


  From: Christian Gadge 
  Sent: Thursday, February 24, 2011 7:53 AM
  To: [email protected] 
  Subject: [Users] How to add array of layers / LayerStore to map


   Hello all,

  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?
  Thank you for some sugestions...

  Here the relevant code:

  /*
  *    Layer
  */
  var OLwms = new OpenLayers.Layer.WMS(
              "Topographic map",
              "http://labs.metacarta.com/wms/vmap0";, 
              {layers: 'basic'},
              {isBaseLayer: true}
                );
              
  var BMwms = new OpenLayers.Layer.WMS(
               "Blue Marble Global Imagery",
                "http://sigma.openplans.org/geoserver/wms?";,
                {layers: 'bluemarble'},
              {isBaseLayer: true }
              );
          
  var NASAwms = new OpenLayers.Layer.WMS( 
              "NASA WMS",
              "http://wms.jpl.nasa.gov/wms.cgi?";, 
              {layers: 'BMNG', format: 'image/png'},
              {isBaseLayer: true}
              );
  ...

  /*
  *    Array with layers
  */

  var layerList =[{    
                  text: 'Background Layers',
                  leaf: false,                    
                  expanded: true,
                  children: [{
                      nodeType: 'gx_layer',
                      layer: OLwms,
                      checked: false
                      }, {
                      nodeType: 'gx_layer',
                      layer: BMwms,
                      checked: false
                      }, {
                      nodeType: 'gx_layer',
                      layer: NASAwms,
                      checked: false
                      },
                      ...
                  ]
  }];
  ...

  /*
  *    the map panel
  */

  var mainPanel = new Ext.Panel({
              region:    'center',
              deferredRender: false,
              margins:        '5 5 5 5',            
              activeTab: 2, 
              items:[
              {
                  xtype:    'gx_mappanel',
                  title:    'Maps',
                  split:     true,
                  map:    mainMap,                
                  layer: ([layerList]),
                  zoomTo:    'maxExtent',
              }]
   });    



  Best regards,
  Christian




------------------------------------------------------------------------------
  _______________________________________________
  Users mailing list
  [email protected]
  http://www.geoext.org/cgi-bin/mailman/listinfo/users



-- 
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 [email protected]

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 

http://www.ufz.de





--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to