Skip to content
ESM
import "@arcgis/map-components/components/arcgis-elevation-profile";
Inheritance:
ArcgisElevationProfilePublicLitElement
Since
ArcGIS Maps SDK for JavaScript 4.28

The Elevation Profile component manages an ElevationProfileAnalysis and displays its elevation profiles.

elevation profile poster

The component can visualize multiple profile lines, depending on whether it is used in an arcgis-map component or an arcgis-scene component and on the available elevation source data:

  • ElevationProfileLineGround: represents a profile line that uses elevation from arcgis-map.ground of the connected Map or Scene component. The profile recomputes automatically when ground layers are added, removed, or their visibility changes.
  • ElevationProfileLineInput: represents a profile line that reads elevation from the analysis geometry itself; typically used for polylines with z values. If the line lacks z values but is displayed with a non-draped elevation mode, a profile is still computed. If elevationInfo is set to on-the-ground, elevation comes from the Ground (when ground layers are present). An elevation offset can be applied. In a Map this requires client-side graphics that already contain z values.
  • ElevationProfileLineQuery: represents a profile line that samples elevation from the elevation source set in the source property. The elevation source can be an ElevationLayer or an object with a method called queryElevation that has the same signature as queryElevation().
  • ElevationProfileLineScene: represents a profile line that derives elevation from the Scene and all its volumetric objects (e.g. SceneLayer, IntegratedMeshLayer).

You can choose to display one or several profile lines in the chart, by setting them in the profiles property.

Hovering over the chart shows an overlaid tooltip with elevation values of all profiles, and displays colored dot markers at the matching positions.

elevation profile chart gif

Checkboxes in the legend allow hiding individual profiles. Chart units can be set via the settings menu to metric, imperial or a specific unit.

Scrolling the chart zooms in to a specific part of the profile chart. When zoomed in, click the minus button to reset the zoom. On touch devices, pinch to zoom in and out.

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).

Known limitations

See also

Demo

Properties

PropertyAttributeType
auto-destroy-disabled
distance-unit
elevation-unit
hide-chart
hide-clear-button
hide-distance-display-unit-select
hide-elevation-display-unit-select
hide-legend
hide-select-button
hide-settings-button
hide-start-button
hide-uniform-chart-scaling-toggle
hide-visualization
highlight-disabled
icon
reflected
icon
Icon["icon"] | undefined
label
progress
readonly
reference-element
state
readonly
"disabled" | "ready" | "selected" | "created" | "creating" | "selecting"
uniform-chart-scaling

analysis

Property
Type
ElevationProfileAnalysis
Since
ArcGIS Maps SDK for JavaScript 5.0

The ElevationProfileAnalysis created or modified by the component.

When connecting the Elevation Profile component to the arcgis-map or arcgis-scene components, it automatically creates an empty analysis and adds it to the Map's arcgis-map.analyses collection or the Scene's arcgis-scene.analyses collection. You can then wait for the ElevationProfileAnalysisView2D or ElevationProfileAnalysisView3D to be created (depending on whether you are using a Map or Scene component) before accessing the analysis results.

// Get the Scene component and the Elevation Profile component, and wait until both are ready.
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
const elevationProfileElement = document.querySelector("arcgis-elevation-profile");
await elevationProfileElement.componentOnReady();
// Get the ElevationProfileAnalysis created by the Elevation Profile component.
const analysis = elevationProfileElement.analysis;
// Get the ElevationProfileAnalysisView3D and watch for results.
const analysisView = await viewElement.whenAnalysisView(analysis);
const handle = reactiveUtils.watch(
() => analysisView?.results,
() => {
console.log("Analysis results:", analysisView.results);
},
);

Whenever the component is destroyed, the analysis is automatically removed from the collection.

Alternatively, a programmatically created ElevationProfileAnalysis can be provided to the component. Then, the application itself needs to add it to and later remove it from the analyses collection of the Map or Scene component.

// Create the ElevationProfileAnalysis.
const analysis = new ElevationProfileAnalysis({
profiles: [{ type: "ground" }, { type: "scene" }]
});
// Get the Scene component and the Elevation Profile component, and wait until both are ready.
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
const elevationProfileElement = document.querySelector("arcgis-elevation-profile");
await elevationProfileElement.componentOnReady();
// Add the analysis to the analyses collection of the Scene component.
viewElement.analyses.add(analysis);
// Connect the analysis to the elevation profile component.
elevationProfileElement.analysis = analysis;

autoDestroyDisabled

Property
Type
boolean

If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy() method when you are done to prevent memory leaks.

Attribute
auto-destroy-disabled
Default value
false

distanceUnit

Property
Type
SystemOrLengthUnit | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The measurement system (imperial, metric) or specific unit (e.g. feet, kilometers) used to display distance values in the chart, results and legend.

Attribute
distance-unit

distanceUnitOptions

Property
Type
Array<SystemOrLengthUnit>
Since
ArcGIS Maps SDK for JavaScript 5.0

List of available units unit systems (imperial, metric) and specific units (e.g. feet, kilometers) for displaying the distance values. These are the options displayed in the distance unit dropdown in the settings popover.

effectiveDisplayUnits

readonly Property
Type
ElevationProfileEffectiveDisplayUnits | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Units which have been selected according to the magnitude of the elevations and distances that are to be displayed in the component, according to the selected elevation and distance units or unit systems.

elevationInfo

Property
Type
ElevationInfo<ElevationInfoMode> | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Specifies how the geometry Z values are interpreted, for example to compute elevations for an input profile line. This property can only be used in a SceneView.

Read more

elevationUnit

Property
Type
SystemOrLengthUnit | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The measurement system (imperial, metric) or specific unit (e.g. feet, kilometers) used to display elevation values in the chart, results and legend.

Attribute
elevation-unit

elevationUnitOptions

Property
Type
Array<SystemOrLengthUnit>
Since
ArcGIS Maps SDK for JavaScript 5.0

List of available units unit systems (imperial, metric) and specific units (e.g. feet, kilometers) for displaying the elevation values. These are the options displayed in the elevation unit dropdown in the settings popover.

feature

Property
Type
Graphic | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The feature which is currently selected for display in the elevation profile. The feature is highlighted in the view and its geometry is used as the profile line. When the user starts drawing a new profile line, this feature is cleared.

geometry

Property
Type
Polyline | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Path along which elevation will be queried in order to generate an elevation profile. It should be a Polyline geometry. Read more

hideChart

Property
Type
boolean

If true, the elevation profile chart will be hidden.

Attribute
hide-chart
Default value
false

hideClearButton

Property
Type
boolean

If true, the clear button will be hidden.

Attribute
hide-clear-button
Default value
false

hideDistanceDisplayUnitSelect

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the distance display unit dropdown will be hidden in the settings popover.

Attribute
hide-distance-display-unit-select
Default value
false

hideElevationDisplayUnitSelect

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the elevation display unit dropdown will be hidden in the settings popover.

Attribute
hide-elevation-display-unit-select
Default value
false

hideLegend

Property
Type
boolean

If true, the legend will be hidden.

Attribute
hide-legend
Default value
false

hideSelectButton

Property
Type
boolean

If true, the button to select features in the view will be hidden.

Attribute
hide-select-button
Default value
false

hideSettingsButton

Property
Type
boolean

If true, the button which opens the settings popover will be hidden.

Attribute
hide-settings-button
Default value
false

hideStartButton

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the button to start sketching a new profile line will be hidden.

Attribute
hide-start-button
Default value
false

hideUniformChartScalingToggle

Property
Type
boolean

If true, the uniform chart scaling toggle will be hidden in the settings popover.

Attribute
hide-uniform-chart-scaling-toggle
Default value
false

hideVisualization

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates whether the component's visualization is hidden in the view.

Attribute
hide-visualization
Default value
false

highlightDisabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the component will not highlight features selected in the view.

Attribute
highlight-disabled
Default value
false

icon

reflected Property
Type
Icon["icon"] | undefined

Icon which represents the component. Typically used when the component is controlled by another component (e.g. by the Expand component).

See also
Attribute
icon
Default value
"altitude"

indicatorRelativePosition

readonly Property
Type
number | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Relative position along the current elevation profile line, in the range [0, 1]. The component updates this value as the user hovers the chart.

Read more

label

Property
Type
string | undefined

The component's default label.

Attribute
label

messageOverrides

Property
Type
Record<string, unknown> | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Replace localized message strings with your own strings.

Note: Individual message keys may change between releases.

profiles

Property
Type
Collection<ElevationProfileLineUnion>

The collection of profile lines to compute and display. Each profile line defines a different source for sampling elevation along the input geometry (such as ground, input geometry itself, custom elevation sources, or scene content), and includes settings for how the resulting line will appear in the component chart and in the view.

Read more

progress

readonly Property
Type
number

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

Read more

referenceElement

Property
Type
ArcgisReferenceElement | string | undefined

By assigning the id attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.

See also
Attribute
reference-element

state

readonly Property
Type
"disabled" | "ready" | "selected" | "created" | "creating" | "selecting"

The component's state. The values mean the following:

  • disabled - component is being created
  • ready - component is ready; no path configured and no interactive operation ongoing
  • creating - user is creating a new input path
  • created - input path is configured but no interactive operation is ongoing
  • selecting - user is selecting an existing input path
  • selected - user selected an existing input path

uniformChartScaling

Property
Type
boolean

Whether the chart should use a uniform scale for the X and Y axes.

Attribute
uniform-chart-scaling
Default value
false

view

Property
Type
MapView | SceneView | undefined

The view associated with the component.

Note: The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this view property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-elevation-profile component will be associated with a map or scene component rather than using the view property.

Methods

MethodSignature
clear(): Promise<void>
componentOnReady
inherited
componentOnReady(): Promise<this>
destroy(): Promise<void>
select(): Promise<void>
start(): Promise<void>
stop(): Promise<void>

clear

Method
Signature
clear (): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 5.0

Clear the current elevation profile. If an interactive operation is in progress, it will also be stopped.

Returns
Promise<void>

componentOnReady

inherited Method
Signature
componentOnReady (): Promise<this>
Inherited from: PublicLitElement

Creates a promise that resolves once the component is fully loaded.

Returns
Promise<this>
Example
const arcgisElevationProfile = document.querySelector("arcgis-elevation-profile");
document.body.append(arcgisElevationProfile);
await arcgisElevationProfile.componentOnReady();
console.log("arcgis-elevation-profile is ready to go!");

destroy

Method
Signature
destroy (): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

select

Method
Signature
select (): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 5.0

Start an interactive operation to pick an existing polyline feature in the view to use as the input for the elevation profile. The operation ends when the user presses the Escape key. To programmatically cancel the operation, call the stop() method.

Returns
Promise<void>

start

Method
Signature
start (): Promise<void>

Start an interactive operation that lets the user sketch a new path in the view along which the elevation profile will be generated. The operation completes when the user double-clicks, presses the Escape key or clicks the Done button in the UI. To programmatically cancel the operation, call the stop() method.

Returns
Promise<void>

stop

Method
Signature
stop (): Promise<void>

Stop any ongoing interactive operation (for example, selecting or sketching a profile line). This can be used to programmatically cancel operations started by start() or select().

Returns
Promise<void>

Events

NameType
CustomEvent<{ name: "analysis" | "effectiveDisplayUnits" | "elevationInfo" | "feature" | "geometry" | "indicatorRelativePosition" | "progress" | "state"; }>

arcgisPropertyChange

Event
arcgisPropertyChange: CustomEvent<{ name: "analysis" | "effectiveDisplayUnits" | "elevationInfo" | "feature" | "geometry" | "indicatorRelativePosition" | "progress" | "state"; }>

Emitted when the value of a property is changed. Use this to listen to changes to properties.

bubbles composed cancelable

arcgisReady

Event
arcgisReady: CustomEvent<void>

Emitted when the component associated with a map or scene view is ready to be interacted with.

bubbles composed cancelable