[Users] Change order of base layers
Andreas Hocevar
ahocevar at opengeo.org
Fri Jan 28 13:16:57 CET 2011
Hey,
all you have to do is configure your OpenLayers.Map with {allOverlays: false}.
Also, note that you don't need to create a LayerStore if you're working with a GeoExt.MapPanel. Just configure the MapPanel's layers property with the result from createLayers.
So your mapPanel configuration could look like this:
{
xtype: "gx_mappanel",
map: {allOverlays: false},
layers: createLayers()
}
Regards,
Andreas.
On Jan 28, 2011, at 13:07 , Vidal, Antoni wrote:
> Hello list,
>
> I have two base layers created on the following way:
>
> In layout.js:
>
> New Ext.viewport({
> .....
> items: [{
> title: 'Layers',
> xtype: "treepanel",
> loader: new Ext.tree.TreeLoader({
> applyLoader: false
> }),
> rootVisible: false,
> root: {
> children: createChildren()
> }
> .....
>
> Function : createChildren():
>
> var createChildren = function(){
> return [{
> "nodeType": "gx_baselayercontainer",
> "text" : "Base",
> "expanded": true
> },{
> "nodeType": "gx_overlaylayercontainer",
> "text" : "Overlays",
> "expanded": false
> }]
> };
>
> .....
>
> init: function() {
>
> var layers = createLayers();
> var layerStore = createLayerStore(map, layers);
> .....
>
> var createLayers = function() {
> return [
> new OpenLayers.Layer.WMS(
> "Topo", "http://server/tilecache/tilecache.py?",
> {layers: 'topo', format:"image/jpeg", isBaseLayer: true}
> ),
> new OpenLayers.Layer.WMS(
> "Orto", "http://server/tilecache/tilecache.py?",
> {layers: 'orto', format:"image/jpeg", isBaseLayer: false}
> ),
> ......
>
> var createLayerStore = function(map, layers) {
> return new GeoExt.data.LayerStore({
> map: map,
> layers: layers
> });
> };
>
> Order showned inside viwer is:
>
> Orto (not actived)
> Topo (actived)
>
> How can I put Topo over Orto and remain active?
>
> Thanks in advance.
>
> Antoni Vidal
> Unitat d'Aplicacions SIG-WEB
> Institut Cartogràfic de Catalunya
> Parc de Montjuïc, E-08038 Barcelona
> Tel. (+34) 93 567 15 00 (ext. 3228)
> www.icc.cat
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list