I am using GeoServer alongwith the default, build in GeoWebCache. I am using Extjs and GeoExt, as well. Everything is running well, except for the legend graphics request. My code for layers is as follows:
var MyLayer = new OpenLayers.Layer.WMS( "MyLayer",
"http://my-ip-address/geoserver/gwc/service/wms",
{layers: 'MyLayer',transparent: "true",format: "image/png",
tileSize: new OpenLayers.Size(256,256),
tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom },
{ isBaseLayer: false, visibility:false} );
And for legend panel:
var legend = new GeoExt.LegendPanel({
title: "Map Legend",
iconCls: 'legend',
autoScroll: true,
defaults: {
cls: 'legend-item',
baseParams: {FORMAT: 'image/png'}
},
items: []
});
Whenever I am trying to open this map, I am getting the layer name in my legend panel, but there is no image for layer legend and firebug is giving this error:
"NetworkError: 400 Bad Request - http://my-ip-address/geoserver/gwc/service/wms?TRANSPARENT=true&TILESIZE=256,256&TILESORIGIN=72.45,24.45&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application.ogc.se_xml&LAYER=MyLayer&FORMAT=image/gif&SCALE=2500000.0000000005&FORMAT=image/png"
I understand I will have to replace part of the URL request for GetLegendGraphic. But I am not able to do the same.Could anybody tell me how to accomplish this?
- I am using GeoServer 2.1.1; GeoWebCache 1.2.6, OpenLayers 2.11, Ext 3.2.1 and GeoExt 1.1.