import LabelOptions from "@arcgis/core/views/interactive/options/LabelOptions.js";
Inheritance
LabelOptions→Accessor
Subclasses
SketchLabelOptions
Since
ArcGIS Maps SDK for JavaScript 5.2

The LabelOptions class allows users to configure the labels which are shown next to each segment of a graphic while sketching, editing or placing analyses. The labels display each segment's horizontal length and are not shown for non-planar polygons and polylines.

sketch-3d

How the segment lengths are computed depends on the view's spatial reference. In geographic coordinate systems (GCS) and in Web Mercator, the lengths are computed geodetically. In projected coordinate systems (PCS), apart from Web Mercator, the lengths are computed in a Euclidean manner (in the respective PCS).

Set the unit system for labels

Use either a Portal or PortalItem to establish the unit system for labels while sketching, editing, or placing analyses.

Read More

The unit of measurement used in the labels can be programmatically set through the PortalItem of a Map by defining the Portal.units property.

// Create a PortalItem instance for the map used in the 3D view
view.map.portalItem = new PortalItem({
portal: {
units: "english" // or "metric"
},
});

Or, if a PortalItem already exists, the Portal.units property can be directly set or changed.

// Set the units directly on an existing PortalItem of the 3D view
view.map.portalItem.portal.units = "english" // or "metric"

Alternatively, if no Portal exists, you can set the Portal.units property from a new default Portal created using the Portal.getDefault() method.

// Create a new Portal instance and set its units
const portal = Portal.getDefault();
portal.units = "english" // or "metric"
See also

Constructors

Constructor

Constructor

Parameters

ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
readonly inherited

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

enabled

Property
Type
boolean

Whether labels are shown next to each segment of a geometry while sketching, editing, or placing analyses.

Default value
false