Display custom labels in a 3D scene.

Use case
Labeling features is useful to visually display information or attributes on a scene. For example, city officials or maintenance crews may want to show installation dates of features of a gas network.
How to use the sample
Pan and zoom to explore the scene. Notice the labels showing installation dates of features in the 3D gas network.
How it works
- Create a scene from a
PortalItem. - Add the scene to a
SceneViewand load it. - After loading is complete, obtain the
FeatureLayerfrom one of theGroupLayers in the scene’s operational layers. - Create a
TextSymbolto use for displaying the label text. - Create a
LabelDefinitionusing anArcadeLabelExpression. - Add the definition to the feature layer with
featureLayer.addLabelDefinition(labelDefinition). - Lastly, enable labels on the layer using
featureLayer.labelsAreEnabled.
Relevant API
- ArcadeLabelExpression
- FeatureLayer
- LabelDefinition
- Scene
- SceneView
- TextSymbol
About the data
This sample shows a New York City infrastructure scene hosted on ArcGIS Online.
Tags
3D, arcade, attribute, buildings, label, model, scene, symbol, text, URL, visualization