[Users] Tree, gx_layer and KML

Fabien fabien.goblet at gmail.com
Fri Nov 13 12:59:57 CET 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20091113/3b5d5bd4/attachment.htm 


More information about the Users mailing list