[Users] Using GeoExt.LayerNode / TreeNode with a Grouped WFS Layer

Andrew Stewart Andrew.Stewart at reddeer.ca
Fri Mar 4 16:21:01 CET 2011


I am trying to replace my existing LayerList control that was using a grouped WMS layer and the layer params so that the layerlist control would still separate the layers into individual items. My problem is I tried to replace the WMS layer with a grouped WFS layer (with multiple featureTypes) except only the entire layer will show up inside the layerlist control for checking on/off instead of individual layers. Can this be done?


My WFS Layer is declared like the following (with multiple featureTypes)

//Areas of Interest Group (WFS)
           var layer_AOIs_wfs = new OpenLayers.Layer.Vector("Attraction", {
                minScale: 125000,
                maxScale: 99,
                //visibility: false,
                styleMap: (myStyles),
                rendererOptions: {zIndexing: true},
                strategies: [new OpenLayers.Strategy.BBOX()],
                 protocol: new OpenLayers.Protocol.WFS({
                 url: wfs,
                 featureType: ["Attraction", "Fire_Hall"],
                 featureNS: "http://www.intergraph.com/geomedia/gml",
                 featurePrefix: "gmgml",
                 srsName: "EPSG:3776",
                 geometryName: "Geometry",
                 version: "1.1.0"
                })
                });



And my layerlist (GeoExt.layerNode) control is like the following except it only loads both the Attraction and FireHall layers into one layer when I expand it, not both.

  //AOIs layerList
        layerList_AOIs = new GeoExt.tree.LayerNode({
        "layer": layer_AOIs_wfs,
        "isLeaf": true,
        "preloadChildren": true,
        "checked": false,
        "enableDD": true,
        "cls": "rootnode",
        "singleClickExpand": true,
        "listeners":
        {
            'checkchange' :  function(node, checked)
                {
                    // If a parent node is unchecked, uncheck all the children
                    if (node.getUI().isChecked()) {
                    node.expand();
                    }
                    if (!node.getUI().isChecked()) {
                    node.collapse();
                    }
                },
             'load' : function(e) {
             if (bool_aois == false)
                {
                    //change icon of childNodes to GetLegendGraphic from WMS + node text attribute
                    var count = (e.childNodes.length -1);
                    while (count >= 0)
                        {
                            var label = e.childNodes[count].text;
                            var fixed_label = label.replace(/_/g,' ');
                            e.childNodes[count].setText("<img src='http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1.1&format=image/png&style=&layer="+label + "'/>" + ' ' +fixed_label);
                            e.childNodes[count].id = fixed_label;
                            count -=1;
                        }
                    bool_aois = true;
                }
             else
             {
                //do nothing
             }
             }
  },
        "loader": {
            "param": "LAYERS"
        }
        });

I have tried modifying the loader part and instead of "LAYERS" tried featureType but this did not have any affect. Can this be done how I am describing? Appreciate any advice!







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110304/0a3f35ed/attachment-0001.htm 


More information about the Users mailing list