import ElevationProfileLineQuery from "@arcgis/core/widgets/ElevationProfile/ElevationProfileLineQuery.js";const ElevationProfileLineQuery = await $arcgis.import("@arcgis/core/widgets/ElevationProfile/ElevationProfileLineQuery.js");- Inheritance:
- ElevationProfileLineQuery→
ElevationProfileLine→ Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.18
Profile line which samples elevation from a custom elevation source, for example by creating a new ElevationLayer, or by using an elevation layer from Ground.layers.
Additionally, you can create your own source object with a method called queryElevation, with the same signature as
ElevationLayer.queryElevation().
- See also
ElevationProfile widget - Deprecated since 5.0. Use the Elevation Profile component instead.
ElevationProfileViewModel - Deprecated since 5.0. Use ElevationProfileAnalysis instead.
ElevationProfileLineGround - Deprecated since 5.0. Use ElevationProfileLineGround from ElevationProfileAnalysis instead.
ElevationProfileLineInput - Deprecated since 5.0. Use ElevationProfileLineInput from ElevationProfileAnalysis instead.
ElevationProfileLineView - Deprecated since 5.0. Use ElevationProfileLineScene from ElevationProfileAnalysis instead.
Example
const elevLayer = new ElevationLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation/MtBaldy_Elevation/ImageServer"});const elevationProfile = new ElevationProfile({ view: view, profiles: [{ type: "query", // autocasts as new ElevationProfileLineQuery(), source: elevLayer }]});Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| | ||
declaredClass readonly inherited | ||
hoveredPoint readonly inherited | ||
id inherited | ||
progress readonly inherited | ||
samples readonly inherited | ||
| | ||
statistics readonly inherited | ||
title inherited | ||
type readonly | "query" | |
| | ||
visible inherited |
hoveredPoint
Point being hovered in the chart, in the view's spatial reference.
id
- Type
- string
Unique identifier for the profile line.
progress
- Type
- number
How far along the generation of this profile is. 0 means nothing was loaded and 1 means loading is complete.
samples
- Type
- ElevationProfileSample[] | null | undefined
List of samples that make up the elevation profile. It can be passed to a graphing library in order to display the profile in 2D.
source
- Type
- ElevationQuerySource
Elevation source used to sample elevation when generating the profile, for example an ElevationLayer.
Example
const elevLayer = new ElevationLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/.../Elevation/ImageServer"});
// profile line with elevation layer sourceconst elevationProfile = new ElevationProfile({ view, profiles: [{ type: "query", // autocasts as new ElevationProfileLineQuery(), source: elevLayer }]});
// profile line with a source coming from an elevation// layer with a specific sampling resolutionconst elevationProfile = new ElevationProfile({ view, profiles: [{ type: "query", source: { queryElevation(geometry, options) { return elevLayer.queryElevation(geometry, { ...options, demResolution: 20 }) } } }]});
// profile line with a source that queries data// on an elevation samplerview.when(async() => { const sampler = await elevLayer.createElevationSampler(extent); const querySource = { queryElevation: async (geometry: Multipoint) => { return { geometry: await sampler.queryElevation(geometry), noDataValue: sampler.noDataValue }; } }; const elevationProfile = new ElevationProfile({ view, profiles: [{ type: "query", source: querySource }] });}); statistics
- Type
- ElevationProfileStatistics | null | undefined
Statistics about the generated elevation profile, if available.
For slope computations, profiles are sampled at a minimum distance of 10 meters (32.8 feet). Higher resolution profiles are downsampled to a 10-meter (32.8-foot) sampling distance before calculating the slope.
title
Title of the line, to be displayed in the chart tooltip and in the chart legend.
viewVisualizationEnabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.20
Whether a line visualization representing elevationSamples should be added to the SceneView. This property doesn't apply to MapView.
- Default value
- true
visible
- Type
- boolean
Whether the line should be computed and shown in the chart.
- Default value
- true
Methods
| Method | Signature | Class |
|---|---|---|
emit inherited | emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean | |
hasEventListener inherited | hasEventListener<Type extends EventNames<this>>(type: Type): boolean | |
on inherited | on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle |
emit
- Signature
-
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
- Type parameters
- <Type extends EventNames<this>>
Emits an event on the instance. This method should only be used when creating subclasses of this class.
hasEventListener
- Signature
-
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
- Type parameters
- <Type extends EventNames<this>>
Indicates whether there is an event listener on the instance that matches the provided event name.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | The name of the event. | |
- Returns
- boolean
Returns true if the class supports the input event.
on
- Signature
-
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
- Type parameters
- <Type extends EventNames<this>>
Registers an event handler on the instance. Call this method to hook an event with a listener.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | An event or an array of events to listen for. | |
| listener | EventedCallback<this["@eventTypes"][Type]> | The function to call when the event fires. | |
- Returns
- ResourceHandle
Returns an event handler with a
remove()method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event.
Example
view.on("click", function(event){ // event is the event handle returned after the event fires. console.log(event.mapPoint);});