Friday, 15 June 2018

javascript - How to force EXT JS - GeoEXT to show legends with OpenLayers?


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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...