[OpenLayers-Users] How can I change the name of layers in tree

Cristhian Boujon cristhianboujon at gmail.com
Mon Jun 24 12:11:44 PDT 2013


Can anyone help me, please?
I really need to do it. Although some tips


On Tue, Jun 18, 2013 at 7:06 AM, Cristhian Boujon <cristhianboujon at gmail.com
> wrote:

> Hello all,
>
> I'm trying to change the name of the layers in the tree using OpenLayers
> and GeoExt
> I get the tree:
>
> layer_group1
>    |_ namespace:layer_a
>    |_ namespace:layer_b
>    |_ namespace:layer_c
>
> layer_group2
>    |_namespace:layer_d
>
> But I want to expect:
>
> layer_group1
>    |_ Layer a
>    |_ Layer b
>    |_ Layer c
>
> layer_group2
>    |_ Layer d
>
>
> This is part of my 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]
>     }
> )
>
>
>   I'm trying to change the name of the layers in the tree. This is part
> of my 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]
>     }
> )
>
> How can I change the name of the layer in the tree?
>
> PS: don't hesitate if you need more code.
>
> Regards,
>
>
> --
> Cristhian A. Boujon.
>
>


-- 
Cristhian A. Boujon.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130624/b92662c2/attachment.html>


More information about the Users mailing list