<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>Hello all,<br><br></div>I'm trying to change the name of the layers in the tree<code> using OpenLayers and GeoExt<br></code>I get the tree:
<pre><code>layer_group1
|_ namespace:layer_a
|_ namespace:layer_b
|_ namespace:layer_c
layer_group2
|_namespace:layer_d
</code></pre>
<p>But I want to expect:</p>
<pre><code>layer_group1
|_ Layer a
|_ Layer b
|_ Layer c
layer_group2
|_ Layer d
</code></pre><br>This is part of my code:<br><br><div><div><pre><code>var layer_group1 = new OpenLayers.Layer.WMS("layer_group1",
url,
{
LAYERS: ['namespace:layer_a','namespace:layer_b','namespace:layer_c'],
format: "image/png",
transparent: "true",
projection: 'EPSG:4326'
},
{
buffer: 0,
displayOutsideMaxExtent: true,
isBaseLayer: false,
displayInLayerSwitcher: false,
yx : {'EPSG:4326' : true}
}
);
var layer_group2 = new OpenLayers.Layer.WMS("layer_group2",
url,
{
LAYERS: 'namespace:layer_d',
format: "image/png",
transparent: "true",
projection: 'EPSG:4326'
},
{
opacity:0.5,
buffer: 3,
displayOutsideMaxExtent: true,
displayInLayerSwitcher: false,
yx : {'EPSG:4326' : true}
}
);
mapPanel = new GeoExt.MapPanel({
border: true,
region: "center",
// we do not want all overlays, to try the OverlayLayerContainer
map: mapa,
center:[-6613943,-3793944],
zoom: 7,
layers: [ capaBase, layer_group1, layer_group2, gmap,gsat,vector]
}
)<br><br></code></pre><table><tbody><tr><td><div>
</div>
<br></td>
<td>
<div>
<div>
<p>I'm trying to change the name of the layers in the tree.
This is part of my code:</p>
<pre><code>var layer_group1 = new OpenLayers.Layer.WMS("layer_group1",
url,
{
LAYERS: ['namespace:layer_a','namespace:layer_b','namespace:layer_c'],
format: "image/png",
transparent: "true",
projection: 'EPSG:4326'
},
{
buffer: 0,
displayOutsideMaxExtent: true,
isBaseLayer: false,
displayInLayerSwitcher: false,
yx : {'EPSG:4326' : true}
}
);
var layer_group2 = new OpenLayers.Layer.WMS("layer_group2",
url,
{
LAYERS: 'namespace:layer_d',
format: "image/png",
transparent: "true",
projection: 'EPSG:4326'
},
{
opacity:0.5,
buffer: 3,
displayOutsideMaxExtent: true,
displayInLayerSwitcher: false,
yx : {'EPSG:4326' : true}
}
);
mapPanel = new GeoExt.MapPanel({
border: true,
region: "center",
// we do not want all overlays, to try the OverlayLayerContainer
map: mapa,
center:[-6613943,-3793944],
zoom: 7,
layers: [ capaBase, layer_group1, layer_group2, gmap,gsat,vector]
}
)
</code></pre>
<p>How can I change the name of the layer in the tree?</p>
<p>PS: don't hesitate if you need more code.</p>
</div></div></td></tr></tbody></table><pre>Regards,<span class="HOEnZb"><font color="#888888"><br></font></span></pre><span class="HOEnZb"><font color="#888888"><br>-- <br>Cristhian A. Boujon.<br><img src="http://img812.imageshack.us/img812/4905/unledhqb.png"><br>
</font></span></div></div></div>
</div>
</div>