I have a legend panel defined as:
var legendPanel = new GeoExt.LegendPanel({
layerStore: app.mapPanel.layers,
title: "Legend",
defaults: {
labelCls: 'mylabel',
style: 'padding:5px'
},
bodyStyle: 'padding:5px',
width: 200,
autoScroll: true
});
In my app is a WMSCapabilities loader defined as:
mynode.appendChild(new GeoExt.tree.LayerContainer({
text: 'Admin Maps',
loader: new GeoExt.tree.WMSCapabilitiesLoader({
url: GEOSERVER_HOST + '/ws/wms?request=GetCapabilities',
layerOptions: {buffer: 0, singleTile: true, ratio: 1},
layerParams: {'TRANSPARENT': 'TRUE'},
// customize the createNode method to add a checkbox to nodes
createNode: function(attr) {
attr.checked = attr.leaf ? false : undefined;
return GeoExt.tree.WMSCapabilitiesLoader.prototype.createNode.apply(this, [attr]);
}
})
}));
In addition to the WMSCapabilitiesLoader, I also add some layers manually, like:
app.mapPanel.map.addLayer(wms_or_wfs_layer);
where:
app = new Ext.Viewport({
layout: "tdgi_border",
renderTo: "mappanel",
items: items
});
and mapPanel is defined as:
items.push({
xtype: "gx_mappanel",
ref: "mapPanel",
region: "center",
map: {
numZoomLevels: 19,
controls: controls,
projection: new OpenLayers.Projection("EPSG:4326"),
displayProjection: new OpenLayers.Projection("EPSG:900913"),
eventListeners: {
"moveend": function(){
}
},
units: "m"
},
layers: [gStreet],
center: new OpenLayers.LonLat(8.0, 10.0).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")),
zoom: 7,
tbar: ["->",{
icon: "img/person.png",
tooltip: "My Account",
handler: function() {}
},
{
icon: "img/polygon.png",
tooltip: "Toggle draw polygon",
handler: function() {
peSelectControl.deactivate();
peDrawControl.activate();
}
}],
bbar: bottomMenu
});
All requests to GeoServer are done through a proxy:
PROXY_HOST = "/resources/proxy.php?url=";
GEOSERVER_HOST = PROXY_HOST + "http://localhost:8081/geoserver";
The maps are served fine. However, the legend grahics for the WMS layers is not loaded as the GetLegendGraphics request appears to be using the wrong URL. Firebug shows the following error when legend graphics are being loaded:
NetworkError: 404 Not Found - http://localhost:9090/myApp/FORMATS=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=nigeria_admin%3AmyWMSLayer?FORMAT=image/gif&SCALE=3466752.130795755"
which is understandable since GeoServer runs on port 8081, and my app runs on port 9090. In other words, GetLegendGraphics request doesn't appear to make use of the proxy. Is there a way I can explicitly define the proxy host for GetLegendGraphics requests. The documentation here doesn't provide any such info. Thanks in advance.