LengthDimension

AMD: require(["esri/analysis/LengthDimension"], (LengthDimension) => { /* code goes here */ });
ESM: import LengthDimension from "@arcgis/core/analysis/LengthDimension.js";
Class: esri/analysis/LengthDimension
Inheritance: LengthDimension Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25

LengthDimension enables the measurement of linear distances between the specified start and end points. Depending on the measure type, either the direct, horizontal, or vertical distance between these points is measured.

length-dimension-measure-types

Length dimensions can be displayed by adding them to a DimensionAnalysis.

// create the dimension object
const lengthDimension = new LengthDimension({
   measureType: "vertical",
   startPoint: new Point({
      spatialReference: {
        wkid: 32610
      },
      x: 265,
      y: 24,
      z: 26
   }),
   endPoint: new Point({
      spatialReference: {
        wkid: 32610
      },
      x: 265,
      y: 24,
      z: 38
   }),
   orientation: 90,
   offset: 2
});
// create analysis and add the dimension object to it.
const dimensionAnalysis = new DimensionAnalysis({
   dimensions: [lengthDimension]
});
// add the analysis to the view
view.analyses.push(dimensionAnalysis);

Known Limitations

  • Dimensioning is only supported in a 3D SceneView.
  • Direct and vertical distances are always computed in a Euclidean manner.
  • How horizontal distances are computed depends on the scene’s spatial reference:
    • In geographic coordinate systems (GCS) and in Web Mercator, they are computed geodetically.
    • In projected coordinate systems (PCS), apart from Web Mercator, they are computed in a Euclidean manner.
  • Vertical and horizontal dimensions can be used to measure distances of up to 100 kilometers. To measure longer distances use the "direct" measureType instead.
See also

Constructors

LengthDimension

Constructor
new LengthDimension(properties)
Parameter
properties Object
optional

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

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
String

The name of the class.

Accessor
Point

Ending point for the dimension.

LengthDimension
String

The type of length that should be measured between the startPoint and endPoint.

LengthDimension
Number

Styling option that controls the shortest distance from the startPoint or endPoint to the dimension line in meters.

LengthDimension
Number

The orientation determines the relative direction the dimension line is extended to.

LengthDimension
Point

Starting point for the dimension.

LengthDimension

Property Details

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

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

endPoint

Property
endPoint Pointautocast

Ending point for the dimension.

measureType

Property
measureType String

The type of length that should be measured between the startPoint and endPoint. The measureType allows the user to measure either the horizontal distance (delta in xy space), vertical distance (elevation difference), or direct distance between the start and end points. If either vertical or horizontal mode is used, the orientation is not applied and the offset direction is relative to the input points (on a plane derived from them).

length-dimension-measure-types

Possible Values:"direct"|"horizontal"|"vertical"

Default Value:"direct"

offset

Property
offset Number

Styling option that controls the shortest distance from the startPoint or endPoint to the dimension line in meters.

length-dimension-offset
Default Value:0

orientation

Property
orientation Number

The orientation determines the relative direction the dimension line is extended to. It applies only to direct dimensions and when an offset is specified.

An orientation of 0 extends the offset upwards, whereas an orientation of 90 extends the offset sideways, to the right side of the dimension when viewing from its start point. When the start and end points are vertically aligned, increasing the orientation rotates the dimension clockwise relative to compass north.

length-dimension-orientation
Default Value:0

startPoint

Property
startPoint Pointautocast

Starting point for the dimension.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor
this

Creates a deep clone of this object.

LengthDimension
Boolean

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

clone

Method
clone(){this}

Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.

Returns
Type Description
this A deep clone of the class instance that invoked this method.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.