[Users] How to add array of layers / LayerStore to map
Matt Priour
mpriour at kestrelcomputer.com
Thu Feb 24 15:16:00 CET 2011
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: users at geoext.org
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
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110224/ed00aaa0/attachment.htm
More information about the Users
mailing list