Label is not working for dynamic feature layer in projected coordinate system

318
0
10-06-2017 05:42 AM
mohannainar1
New Contributor III

The below code is working for geographic coordinate system(Both base map and operational layers are in GCS) . But when i switch to Projected coordinate system (both basemap and operational layer) the label is not working but rendering is happening. 

The temporal layer i am creating dynamically , not from the mapservice . 

Renderer : function (){

var statesColor = new Color("#060606");
var statesLabel = new TextSymbol().setColor(statesColor);
statesLabel.font.setSize("14pt");
statesLabel.font.setFamily("arial");
var json = {
"labelExpressionInfo": {"value": "{POPULATION}"}
};
var labelClass = new LabelClass(json);
labelClass.symbol = statesLabel;
this.temporalLayer.setLabelingInfo([ labelClass ]);
this.map.addLayer(this.temporalLayer);
smartMapping.createClassedColorRenderer({
layer: this.temporalLayer,
field: "POPULATION",
basemap: "streets",
classificationMethod: this.checkClassificationType.value,
numClasses: this.checkClassificationNumber.value
}).then(lang.hitch(this, function (response) {
var colorArray = this.interpolateColors("rgb(" + this.fromColor.color.r + "," + this.fromColor.color.g + "," + this.fromColor.color.b +")", "rgb(" + this.toColor.color.r + "," + this.toColor.color.g + "," + this.toColor.color.b + ")", this.checkClassificationNumber.value);
for (var i = 0; i < colorArray.length ; i++) {
response.renderer.infos.symbol.color.r = colorArray[0];
response.renderer.infos.symbol.color.g = colorArray[1];
response.renderer.infos.symbol.color.b = colorArray[2];
}
this.temporalLayer.setRenderer(response.renderer);
this.temporalLayer.redraw();
}));
},

interpolateColors : function (color1, color2, steps) {
var stepFactor = 1 / (steps - 1),
interpolatedColorArray = [];

color1 = color1.match(/\d+/g).map(Number);
color2 = color2.match(/\d+/g).map(Number);

for (var i = 0; i < steps; i++) {
interpolatedColorArray.push(this.interpolateColor(color1, color2, stepFactor * i));
}

return interpolatedColorArray;
},

interpolateColor:function (color1, color2, factor) {
if (arguments.length < 3) {
factor = 0.5;
}
var result = color1.slice();
for (var i = 0; i < 3; i++) {
result = Math.round(result + factor * (color2 - color1));
}
return result;
},

0 Kudos
0 Replies