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);
Solved! Go to Solution.
John,
If you are using 3.13 of the API, there appears to be a bug in labeling polylines. Here is a thread that speaks to that point.
LabelLayer (API version 3.13) is not working with Line FeatureLayer
For a workaround you can go back to 3.12 of the API which does label lines correctly. If you have some other 3.13 specific code, that may not be an option though.
Regards,
Tom
John,
If you are using 3.13 of the API, there appears to be a bug in labeling polylines. Here is a thread that speaks to that point.
LabelLayer (API version 3.13) is not working with Line FeatureLayer
For a workaround you can go back to 3.12 of the API which does label lines correctly. If you have some other 3.13 specific code, that may not be an option though.
Regards,
Tom
Yes I'm on 3.13. I'll jump back to 3.12 for this one and see what magic I can make happen. Thanks for the link.
** Update: Yeah, went back to 3.12 and what do you know, Labels **
You are welcome! I hope it makes the magic happen.
Regards,
Tom