Skip to content
import ElevationProfileViewModel from "@arcgis/core/widgets/ElevationProfile/ElevationProfileViewModel.js";
Inheritance:
ElevationProfileViewModelAccessor
Since
ArcGIS Maps SDK for JavaScript 4.18

Provides the logic for the ElevationProfile widget.

How distance values are computed depends on the map's spatial reference:

  • In geographic coordinate systems (GCS) and in Web Mercator, distances are computed geodetically.
  • In projected coordinate systems (PCS), apart from Web Mercator, distances are computed in a Euclidean manner (in their respective PCS).
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.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

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

effectiveUnits

readonly Property
Type
EffectiveUnits

Units which have been selected according to the magnitude of the elevations and distances that are to be displayed in the widget, according to the selected unit or unit system.

highlightEnabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.20

Whether the graphic used as ElevationProfile.input is highlighted. The highlight color and opacity can be changed in SceneView.highlights.

Default value
true

hoveredChartPosition

Property
Type
number | null | undefined

The position, in the range [0, 1], being hovered in the graph. We'll use this to determine which samples are being hovered and mark their position in the view.

input

autocast Property
Type
Graphic | null | undefined

The input path along which elevation will be queried in order to generate an elevation profile.

Typically not set when creating the widget. In this case the widget starts empty, and waits for the user to either draw a new profile or generate a profile from selecting a line feature. The result of this action populates input. input can be set when constructing the widget, or set or changed at runtime. The input graphic must contain a geometry of type Polyline. Symbol and attributes of the input graphic are ignored.

profiles

autocast Property
Type
Collection<ElevationProfileLineUnion>

Collection of elevation profile lines which are to be generated and displayed in the widget's chart. See the different profile line types for details on usage and behavior.

Once an elevation profile is generated, each line will contain the raw data used to generate the chart and statistics. The order of the profiles within the collection determines the drawing order on the chart.

In a MapView ElevationProfileLineView is not supported.

progress

readonly Property
Type
number

The progress, between 0 and 1 of generating all the configured elevation profiles.

state

readonly Property
Type
ElevationProfileState

The current state of the view model that can be used for rendering the UI of the widget.

ValueDescription
disabledwidget is being created
readywidget is ready. No path configured and no interactive operation ongoing.
creatinguser is creating a new input path.
createdinput path is configured but no interactive operation is ongoing.
selectinguser is selecting an existing input path.
selecteduser selected an existing input path.
Default value
"disabled"

uniformChartScaling

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.20

Whether the chart should use a uniform scale for the X and Y axes. When a uniform scale is applied, the X axis will display the same distance units per pixel as the elevation units per pixel displayed in the Y axis.

Default value
false

unit

Property
Type
SystemOrLengthUnit

Unit system (imperial, metric) or specific unit used for displaying the elevation and distance values.

unitOptions

Property
Type
SystemOrLengthUnit[]

List of available units and unit systems (imperial, metric) for displaying the elevation and distance values.

view

Property
Type
MapViewOrSceneView | null | undefined

A reference to the View.

Methods

MethodSignatureClass
cancel(): void
clear(): void
start(options?: InteractionStartOptions): void
stop(): void

cancel

Method
Signature
cancel (): void

Stops a creation/selection operation and restores the previously configured input path.

Returns
void

clear

Method
Signature
clear (): void

Clears the existing profile and stops any interaction.

Returns
void

start

Method
Signature
start (options?: InteractionStartOptions): void

If mode is "sketch" (the default), switches to the "creating" state in which the user can draw a new line. If the mode is "select", switches to the "selecting" state and lets the user click on the view to select an existing line.

If any line is present, when the first point is drawn or an existing line is selected, the previous input is discarded.

Parameters
ParameterTypeDescriptionRequired
options

Start options.

Returns
void

stop

Method
Signature
stop (): void

Stops a creation/selection operation. If the current operation is a "sketch" and the input has at least two committed points (not being dragged), the input is kept. Otherwise the input is set to null.

Returns
void