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 :),
elshae
Best Answer
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.