Skip to content

Files

Latest commit

duffhandy-weiswilliambohrmann3ZackAllendotMorten
Apr 19, 2023
4d12ac4 · Apr 19, 2023

History

History
39 lines (24 loc) · 1.18 KB

File metadata and controls

39 lines (24 loc) · 1.18 KB

Show labels on layer 3D

Display custom labels in a 3D scene.

Show labels on layer in 3D

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:

  1. Create a Scene from a URL, then load.
  2. After loading is complete, obtain the gas layer from the scene's operational layers.
  3. From the gas layer, find the main gas sublayer.
  4. Create a TextSymbol to use for displaying the label text.
  5. Create a LabelDefinition using an ArcadeLabelExpression.
  6. 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