Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a GeoExt.LegendPanel which is working just fine for layers which are not grouped. However, the grouped layers do not show any icon in the LegendPanel. I have tried to create the group layer various ways, using the exact name of the layer group in Geoserver and aldo by specifying a layer string in code. I've been looking around for a while now, but I don't see what I am missing..

Here is relevant code:

//Layer Group
var geography2 = new OpenLayers.Layer.WMS(
                    "Geography2", "http://localhost:8080/geoserver/wms", {layers: 'cite:geog_multipol_vw,cite:geog_multiline_vw', transparent: true}, {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true, minScale: 27734017.045258757}

//LegendPanel config
var legend = new GeoExt.LegendPanel({
                region: "east",
                title: "Legend",
                width: 200,
                autoScroll: true,
                layerStore: mapPanel.layers

//Explicitly point LegendPanel to GetLegendGraphic on WMS Geoserver for GeoWebCached Layers
            var LayerRec;
            for(var l = 4; l < map.layers.length; l++)
                LayerRec = mapPanel.layers.getAt(l);
                LayerRec.set("legendURL","http://localhost:8080/geoserver/wms?TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&FORMAT=image%2Fgif&LAYER=" + map.layers[l].params["LAYERS"]);

Thanks for your time in trying to help me :),


share|improve this question
You post this questions a while ago. Did you find a solution for your problem? I found your post because I'm looking for a solution to a similar problem. Anyway, in your code, you start at checking the layers from index 4. I was wondering if it was I typo, or something related to the part of the code that we don't see. – user2860 May 3 '11 at 4:06

do the legend graphics work when you request them directly in the browser? If so there is a problem with the way you are adding them to the legend panel, if not then there is a problem with GeoServer and you need to file a bug report.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.