Hello,Thanks for the reply. I'm using ArcGIS server 10.1. I'm pretty sure it supports generate renderer task, because I can even see it while accessing from http://192.168.2.5:6080/arcgis/rest/services/fangming/SOM_DynamicMap/MapServer/0I'm using the same code in Javascript from the sample.var classDef = new ClassBreaksDefinition();
classDef.classificationField = "attr1";
classDef.classificationMethod = "natural-breaks"; // always natural breaks
classDef.breakCount = 5; // always five classes
classDef.baseSymbol = app.sfs;
var colorRamp = new AlgorithmicColorRamp();
colorRamp.fromColor = new Color.fromHex("#ffffcc");
colorRamp.toColor = new Color.fromHex("#006837");
colorRamp.algorithm = "hsv"; // options are: "cie-lab", "hsv", "lab-lch"
classDef.baseSymbol = new SimpleFillSymbol("solid", null, null);
classDef.colorRamp = colorRamp;
var params = new GenerateRendererParameters();
params.classificationDefinition = classDef;
console.dir("classDef");
console.dir(classDef);
var generateRenderer = new GenerateRendererTask("http://192.168.2.5:6080/arcgis/rest/services/fangming/SOM_DynamicMap/MapServer/0");
generateRenderer.execute(params, applyRenderer, errorHandler);
function applyRenderer(renderer) {
console.dir(JSON.stringify(renderer));
var optionsArray = [];
var drawingOptions = new LayerDrawingOptions();
drawingOptions.renderer = renderer;
optionsArray[2] = drawingOptions;
basemap.setLayerDrawingOptions(optionsArray);
basemap.show();
}
Then I printed out the renderer object as following:{"breaks":[[0.00215526,0.0100578],[0.0100578,0.0181308],[0.0181308,0.0302279],[0.0302279,0.0463656],[0.0463656,0.0627432]],"_symbols":{"0.00215526-0.0100578":{"type":"simplefillsymbol","style":"solid","color":{"r":255,"g":255,"b":204,"a":1}},"0.0100578-0.0181308":{"type":"simplefillsymbol","style":"solid","color":{"r":184,"g":217,"b":130,"a":1}},"0.0181308-0.0302279":{"type":"simplefillsymbol","style":"solid","color":{"r":97,"g":179,"b":72,"a":1}},"0.0302279-0.0463656":{"type":"simplefillsymbol","style":"solid","color":{"r":28,"g":142,"b":45,"a":1}},"0.0463656-0.0627432":{"type":"simplefillsymbol","style":"solid","color":{"r":0,"g":104,"b":55,"a":1}}},"infos":[{"classMaxValue":0.0100578,"label":"0.00216 - 0.01006","description":"","symbol":{"type":"simplefillsymbol","style":"solid","color":{"r":255,"g":255,"b":204,"a":1}},"minValue":0.00215526,"maxValue":0.0100578},{"classMaxValue":0.0181308,"label":"0.01007 - 0.01813","description":"","symbol":{"type":"simplefillsymbol","style":"solid","color":{"r":184,"g":217,"b":130,"a":1}},"minValue":0.0100578,"maxValue":0.0181308},{"classMaxValue":0.0302279,"label":"0.01814 - 0.03023","description":"","symbol":{"type":"simplefillsymbol","style":"solid","color":{"r":97,"g":179,"b":72,"a":1}},"minValue":0.0181308,"maxValue":0.0302279},{"classMaxValue":0.0463656,"label":"0.03024 - 0.04637","description":"","symbol":{"type":"simplefillsymbol","style":"solid","color":{"r":28,"g":142,"b":45,"a":1}},"minValue":0.0302279,"maxValue":0.0463656},{"classMaxValue":0.0627432,"label":"0.04638 - 0.06274","description":"","symbol":{"type":"simplefillsymbol","style":"solid","color":{"r":0,"g":104,"b":55,"a":1}},"minValue":0.0463656,"maxValue":0.0627432}],"attributeField":"attr1","classificationMethod":"natural-breaks","isMaxInclusive":true}