My sld is applying as below
function cusMap(strSld_body,talukaName,name){
console.log(strSld_body);
var query = new OpenLayers.Layer.WMS.Post(name,
geoServerURL, {
LAYERS : 'VP:village_customize',
sld_body : strSld_body,
format : 'image/jpeg',
transparent : 'true'
},
{
unsupportedBrowsers: [],
isBaseLayer: false,
yx : {'EPSG:4326' : true}
} );
query.mergeNewParams({'CQL_FILTER': "Taluka='"+talukaName+"'"});
query.mergeNewParams({'sld_body': strSld_body});
query=registerEvents(query);
map.addLayer(query);
}
But the legend is not coming as per sld made. How can I force legends to show up?
I am using Ext JS Tree to show legends.
Ext.onReady(function() {
var mapPanel = new GeoExt.MapPanel({
renderTo : 'mymap',
width:780,
zoom:7,
region: "center",
//autoWidth:true,
boxMaxWidth : 762,
boxMaxHeight : 490,
map: map
//layout: "fit"
});
var tree = new Ext.tree.TreePanel({
renderTo : 'mytree',
region: "east",
title: "Layers / Legends",
width: 230,
boxMaxHeight : 455,
autoScroll: true,
enableDD: true,
collapsible: false,
split: false,
plugins: [{
ptype: "gx_treenodecomponent"
}],
loader: {
applyLoader: true,
uiProviders: {
"custom_ui": LayerNodeUI
}
},
root: {
nodeType: "gx_layercontainer",
loader: {
baseAttrs: {
uiProvider: "custom_ui"
},
createNode: function(attr) {
// add a WMS legend to each node created
attr.component = {
xtype: "gx_wmslegend",
layerRecord: mapPanel.layers.getByLayer(attr.layer),
showTitle: false,
cls: "legend"
}
return GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr);
}
}
},
rootVisible: false,
lines: true
});
new Ext.Viewport({
layout: 'border',
region: 'center',
autoScroll: true,
split: false,
renderTo : 'bodypanel',
items: [
mapPanel,tree
]
});
});
No comments:
Post a Comment