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);
labelGraphic = new Graphic(pipePoint, textSymbol); if (labelGraphic != null) map.graphics.add(labelGraphic); Please help me how to add the textSymbol to the polyline. | ||||||
A polyline doesn't have an angle, only a straight line does. But a polyline is made up of smaller straight line segments. Find the segment where you want to place the symbol and calculate it's angle.