AnsweredAssumed Answered

How do I label a featureLayer Polyline?

Question asked by thejohnny on Jun 29, 2015
Latest reply on Jun 29, 2015 by tsellste

I currently have a Polyline featureLayer that I'm trying to label.  This is what I have so far.  I'm thinking after doing quite a bit of reading I need to find the center of the line and label it there.  I'm not sure so I'm reaching out. 

       

// Label Roadway Projects
        var friRoadwayColor = new Color("#000");
        var friRoadwayLabel = new TextSymbol().setColor(friRoadwayColor);
        friRoadwayLabel.font.setSize("13pt");
       
friRoadwayLabel.font.setWeight(Font.WEIGHT_BOLD);
        friRoadwayLabel.font.setFamily("Calibri");
        friRoadwayLabel.font.setDecoration("underline");
       
friRoadwayLabel.font.setStyle(Font.STYLE_ITALIC);
        
        var friRoadwayLabelRenderer = new SimpleRenderer(friRoadwayLabel);
        
        var friRoadwaylabels = new LabelLayer({
id: "friRoadwaylabels" });
       
friRoadwaylabels.addFeatureLayer(friRoadway, friRoadwayLabelRenderer, "{NAME}");
        map.addLayer(friRoadwaylabels);

Outcomes