AnsweredAssumed Answered

Add the textSymbol to the center of polyLine

Question asked by skkalagata on Dec 19, 2014
Latest reply on Dec 29, 2014 by HHeijenga-esristaff

Hi,

I would like to print a textSymbol on center of the ployLine using the Longitude and Latitude.

I Have written the below code, but Unable to print the textSymbol.

 

var labelGraphic = null;

var startX = lLong[0];// These are string values

var endX = lLong[lLong.length-1];

 

var startY= lLat[0];

var endY = lLat[lLat.length-1];

var midPointX = ((endX - startX) / 2);

var midPointY = ((endY - startY) / 2);

 

var font = new Font("12px", Font.STYLE_NORMAL, Font.STYLE_NULL, Font.VARIANT_NORMAL, Font.WEIGHT_NULL, "Arial");  

var pipePoint = new Point(((parseFloat(lLong[0]))+midPointX ) , ((parseFloat(lLat[0]))+ midPointY), map.spatialReference);

// create a text symbol 


var textSymbol = new TextSymbol("LABEL TEXT!!!", font, new Color([0, 0, 0])); 

labelGraphic = new Graphic(pipePoint, textSymbol);

if (labelGraphic != null)

        map.graphics.add(labelGraphic);

 

Please help me how to add the textSymbol to the polyline.

Outcomes