import ElevationProfileLineQuery from "@arcgis/core/analysis/ElevationProfile/ElevationProfileLineQuery.js";const ElevationProfileLineQuery = await $arcgis.import("@arcgis/core/analysis/ElevationProfile/ElevationProfileLineQuery.js");- Inheritance:
- ElevationProfileLineQuery→
ElevationProfileLine→ Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Represents a profile line that samples elevation from a custom elevation source, such as an ElevationLayer, or from an elevation layer in Ground.layers.
You can also provide a custom source object with a queryElevation method that matches the signature of
ElevationLayer.queryElevation(), allowing for flexible elevation sampling
strategies.
- See also
Example
// Create an elevation profile analysis with a custom elevation layer as the sourceconst elevationLayer = new ElevationLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation/MtBaldy_Elevation/ImageServer"});
const analysis = new ElevationProfileAnalysis({ profiles: [{ type: "query", source: elevationLayer }]});Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
chartOptions inherited | ||
| | ||
declaredClass readonly inherited | ||
enabled inherited | ||
id inherited | ||
| | ||
title inherited | ||
type readonly | "query" | |
viewOptions inherited |
chartOptions
Options for visualizing the profile line in a chart.
enabled
- Type
- boolean
Indicates whether the line should be computed and displayed in the chart and view.
- Default value
- true
id
- Type
- string
Unique identifier for the profile line. This value is automatically generated unless specified.
source
- Type
- ElevationQuerySource
Elevation source used to sample elevation when generating the profile, for example an ElevationLayer.
Examples
const elevationLayer = new ElevationLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/.../Elevation/ImageServer"});
// Profile line with elevation layer sourceconst analysis1 = new ElevationProfileAnalysis({ profiles: [{ type: "query", // Autocasts as new ElevationProfileLineQuery(), source: elevationLayer }]});// Profile line with a source coming from an elevation// layer with a specific sampling resolutionconst analysis2 = new ElevationProfileAnalysis({ profiles: [{ type: "query", source: { queryElevation(geometry, options) { return elevationLayer.queryElevation(geometry, { ...options, demResolution: 20 }) } } }]});// Profile line with a source that queries data// on an elevation samplerconst sampler = await elevationLayer.createElevationSampler(extent);
const analysis3 = new ElevationProfileAnalysis({ profiles: [{ type: "query", source: { queryElevation: async (geometry: Multipoint) => { return { geometry: await sampler.queryElevation(geometry), noDataValue: sampler.noDataValue }; } } }]}); title
Title of the line, shown in the chart tooltip and legend.
viewOptions
Options for visualizing the profile line in the view.
Methods
| Method | Signature | Class |
|---|---|---|
clone inherited | clone(): this |
clone
- Signature
-
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
- this
A deep clone of the class instance that invoked this method.
Type definitions
ElevationQuerySource
queryElevation
- Signature
-
queryElevation (geometry: Multipoint, options?: ElevationQueryOptions): Promise<ElevationQueryResult<Multipoint>>
Function used to query elevation values for a Multipoint geometry. It returns a promise that resolves with an ElevationQueryResult.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The geometry to use for sampling elevation data. | | |
| options | Additional query options. | |
- Returns
- Promise<ElevationQueryResult<Multipoint>>
Resolves to an object with the sampled geometry, resolution information, and no data value.