Show labels on layer 3D
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
To open a web scene from a portal item:
- Create a
Scene
from a URL, then load. - After loading is complete, obtain the gas layer from the scene's operational layers.
- From the gas layer, find the main gas sublayer.
- Create a
TextSymbol
to use for displaying the label text. - Create a
LabelDefinition
using anArcadeLabelExpression
. - Add the definition to the feature layer's
labelDefinitions
list.
Relevant API
- ArcadeLabelExpression
- LabelDefinition
- Scene
- SceneView
About the data
This sample shows a New York City infrastructure scene hosted on ArcGIS Online.
Tags
3D, labeling, scene, web scene