Skip to content

ElevationProfileAnalysis

ESM: import ElevationProfileAnalysis from "@arcgis/core/analysis/ElevationProfileAnalysis.js";
CDN: const ElevationProfileAnalysis = await $arcgis.import("@arcgis/core/analysis/ElevationProfileAnalysis.js");
Class: @arcgis/core/analysis/ElevationProfileAnalysis
Inheritance: ElevationProfileAnalysisAnalysisAccessor
Since: ArcGIS Maps SDK for JavaScript 4.34
beta

The ElevationProfileAnalysis class enables programmatic creation and management of elevation profiles in both, a SceneView and a MapView. An elevation profile visualizes elevation changes along a specified Polyline, which is provided via the geometry property.

This analysis supports multiple profile lines, each representing a different source or method for sampling elevation, such as ground, input geometry, custom elevation sources, or scene content. The configuration of these lines is managed through the profiles property.

To add an elevation profile analysis to a view:

const elevationProfileAnalysis = new ElevationProfileAnalysis({
  profiles: [
    // Profile line that samples the ground elevation
    {
      type: "ground",
      color: "rgb(150, 75, 0)",
    }
  ],
  geometry: new Polyline({ })
});

view.analyses.add(elevationProfileAnalysis);

The MapView.analyses and SceneView.analyses collections can contain multiple elevation profile analyses simultaneously.

Use the ElevationProfileAnalysisView2D or ElevationProfileAnalysisView3D to retrieve the analysis results. The combined statistics, as well as results for each computed profile line, can be then visualized in a custom chart using any charting library, embedded in a dashboard, exported as a CSV file, or used for further calculations.

// Get the analysis view
const analysisView = await view.whenAnalysisView(elevationProfileAnalysis);
// Retrieve the results, once they are ready
reactiveUtils.watch(
  () => analysisView.progress,
  (progress) => {
    if (progress === 1) {
      console.log("Results are computed", analysisView.results);
      console.log("Statistics are computed", analysisView.statistics);
    }
  }
);

To interactively place an elevation profile, use the ElevationProfileAnalysisView2D.place() or ElevationProfileAnalysisView3D.place() methods.

const abortController = new AbortController();

try {
  // Start placing a new profile line interactively
  await analysisView.place({ signal: abortController.signal });
} catch (error) {
  if (error.name === "AbortError") {
    console.log("Placement operation was cancelled.");
  }
}

// Cancel the operation at some later point
abortController.abort();

How distances are computed depends on the scene's or map's spatial reference:

  • In geographic coordinate systems (GCS) and in Web Mercator, distances are computed geodetically, taking the curvature of the planet into consideration.
  • In projected coordinate systems (PCS), apart from Web Mercator, the distances are computed in a Euclidean manner (in their respective PCS).

For a ready-to-use UI, use the Elevation Profile component, which allows users to interactively place an elevation profile and view the results in a chart.

See also

Constructors

ElevationProfileAnalysis

Constructor
new ElevationProfileAnalysis(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 Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

The name of the class.

Accessor

Unit systems (imperial, metric) or specific units used for computing and displaying elevation profile results.

ElevationProfileAnalysis

Specifies how the geometry's Z values are interpreted, for example to compute elevations for an input profile line.

ElevationProfileAnalysis

The Polyline along which elevation is to be sampled.

ElevationProfileAnalysis

A user settable identifier for the analysis.

Analysis

The origin of the analysis.

Analysis

The collection of profile lines to compute and display.

ElevationProfileAnalysis

The analysis type.

ElevationProfileAnalysis

An automatically generated unique identifier assigned to the instance.

Analysis

Indicates whether the analysis is ready to be computed and interacted with in the view.

ElevationProfileAnalysis

Configuration options for visualizing an elevation profile within a view.

ElevationProfileAnalysis

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.

displayUnits

Property
displayUnits ElevationProfileDisplayUnitsautocast

Unit systems (imperial, metric) or specific units used for computing and displaying elevation profile results.

If not specified, units are chosen automatically based on the magnitude of the results. The effective units can be accessed through the ElevationProfileAnalysisView2D.results or ElevationProfileAnalysisView3D.results properties.

elevationInfo

Property
elevationInfo ElevationInfo |null |undefinedautocast

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

geometry

Property
geometry Polyline |null |undefinedautocast

The Polyline along which elevation is to be sampled.

id

Inherited
Property
id String
Inherited from Analysis

A user settable identifier for the analysis. A unique value is automatically generated when the analysis is created if it is not set explicitly during construction.

origin

Inherited
Property
origin AnalysisOriginWebScene |null |undefinedautocast
Inherited from Analysis

The origin of the analysis. The origin can be of type web-scene when the analysis was applied from the WebScene.initialViewProperties or a Slide.

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 charts and in the view.

In a MapView, ElevationProfileLineScene is not supported.

type

Property
type Stringreadonly

The analysis type.

For ElevationProfileAnalysis the type is always "elevation-profile".

uid

Inherited
Property
uid Stringreadonly
Inherited from Analysis

An automatically generated unique identifier assigned to the instance. The unique id is generated each time the application is loaded.

valid

Property
valid Booleanreadonly

Indicates whether the analysis is ready to be computed and interacted with in the view. It requires the geometry to be a valid polyline with at least one path containing two points.

viewOptions

Property
viewOptions ElevationProfileViewOptionsautocast

Configuration options for visualizing an elevation profile within a view.

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.

Analysis

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

Inherited
Method
clone(){this}
Inherited from Analysis

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.