[Users] Tree, gx_layer and KML

Christian Spanring christian at spanring.eu
Sat Nov 14 17:16:08 CET 2009


Fabien,

I think the problem is that you specify "sundials" instead of "Sun"
(the name of your kml-layer) in your treeConfig.

Christian

On Fri, Nov 13, 2009 at 6:59 AM, Fabien <fabien.goblet at gmail.com> wrote:
> Hi,
> I'm trying to add a simple KML layer in the treePanel but without success.
> It works with the gx_overlaylayercontainer type but not with the gx_layer.
>
> the KML :
>     var sundials = new OpenLayers.Layer.Vector("Sun", {
>         projection: map.displayProjection,
>         strategies: [new OpenLayers.Strategy.Fixed()],
>         protocol: new OpenLayers.Protocol.HTTP({
>             url: "data/kml/sundials.kml",
>             format: new OpenLayers.Format.KML({
>                 extractStyles: true,
>                 extractAttributes: true
>             })
>         })
>     });
>
> the TreePanel :
>     var treeConfig = new OpenLayers.Format.JSON().write([{
>             nodeType: 'gx_baselayercontainer',
>             text: 'Base layers',
>             expanded: true,
>             allowDrag: false,
>             allowDrop: false,
>             draggable: false,
>             icon: 'icon/imagimap/map.png'
>         },{
>             nodeType: 'gx_overlaylayercontainer',   /* ok, the kml displays
> */
>             text: 'All overlays',
>             expanded: true,
>             allowDrag: false,
>             allowDrop: false,
>             draggable: false,
>             icon: 'icon/imagimap/map.png'
>         },{
>             text: 'Overlays',
>             icon: 'icon/imagimap/map_layer.png',
>             expanded: true,
>             children: [{
>                 nodeType: 'gx_layer', /* this GML works */
>                 layer: 'moutains',
>                 text: 'Montagnes d\'Europe',
>                 qtip: "Montagnes d'Europe",
>                 icon: 'icon/imagimap/map.png'
>             },{
>                 nodeType: 'gx_layer', /* this GML works */
>                 text: 'Villes d\'Europe',
>                 layer: 'city',
>                 qtip: "Villes d'Europe",
>                 icon: 'icon/imagimap/map.png'
>             },{
>                 nodeType: 'gx_layer', /* the kml doesn't display and I have
> this error : this.node.layer.getVisibility is not a function */
>                 text: 'blop',
>                 layer: 'sundials',
>                 qtip: "blop",
>                 icon: 'icon/imagimap/map.png'
>             }]
>         }], true
>     );
>
> I also get the same error when I decided to add a baseLayer by the nodeType
> gx_layer.
>
> Do you know why I get this error message.
>
> Best regards,
>
> Fabien Goblet
> http://www.geotribu.net
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>


More information about the Users mailing list