AnsweredAssumed Answered

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

Question asked by esrimohan on Oct 6, 2017

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[i].symbol.color.r = colorArray[i][0];
response.renderer.infos[i].symbol.color.g = colorArray[i][1];
response.renderer.infos[i].symbol.color.b = colorArray[i][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[i] = Math.round(result[i] + factor * (color2[i] - color1[i]));
}
return result;
},

Outcomes