Skip to content
import ElevationProfileAnalysis from "@arcgis/core/analysis/ElevationProfileAnalysis.js";
Inheritance:
ElevationProfileAnalysisAnalysisAccessor
Since
ArcGIS Maps SDK for JavaScript 4.34

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

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.

displayUnits

autocast Property
Type
ElevationProfileDisplayUnits

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

autocast Property
Type
ElevationInfo | null | undefined

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

autocast Property
Type
Polyline | null | undefined

The Polyline along which elevation is to be sampled.

id

readonlyinherited Property
Type
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

autocast inherited Property
Type
AnalysisOriginWebScene | null | undefined
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.

profiles

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

In a MapView, ElevationProfileLineScene is not supported.

type

readonly Property
Type
"elevation-profile"

The analysis type.

uid

readonlyinherited Property
Type
string
Inherited from: IdentifiableMixin

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

valid

readonly Property
Type
boolean

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

autocast Property
Type
ElevationProfileViewOptions

Configuration options for visualizing an elevation profile within a view.

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
clear(): void
clone
inherited
clone(): this
equals
inherited
equals(other: this): boolean
setGeometryFromFeature(feature: Graphic): void
toJSON
inherited
toJSON(): any

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameters
ParameterTypeDescriptionRequired
json
any

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
any

Returns a new instance of this class.

clear

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

Clears the analysis by resetting the geometry and elevationInfo properties.

Returns
void

clone

inherited Method
Signature
clone (): this
Inherited from: ClonableMixin

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
this

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

equals

inherited Method
Signature
equals (other: this): boolean
Inherited from: Analysis
Since
ArcGIS Maps SDK for JavaScript 5.0

Compares this analysis with another analysis to determine whether they are equivalent.

Parameters
ParameterTypeDescriptionRequired
other

The other analysis to compare against.

Returns
boolean

true if the analyses are equivalent and false otherwise.

setGeometryFromFeature

Method
Signature
setGeometryFromFeature (feature: Graphic): void
Since
ArcGIS Maps SDK for JavaScript 5.0

Sets the analysis geometry and elevation info from the provided feature.

Parameters
ParameterTypeDescriptionRequired
feature

The feature from which to set the analysis geometry and elevation info.

Returns
void

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
any

The ArcGIS portal JSON representation of an instance of this class.