ViewshedAnalysisView3D

ESM: import ViewshedAnalysisView3D from "@arcgis/core/views/3d/analysis/ViewshedAnalysisView3D.js";
CDN: const ViewshedAnalysisView3D = await $arcgis.import("@arcgis/core/views/3d/analysis/ViewshedAnalysisView3D.js");
Class: @arcgis/core/views/3d/analysis/ViewshedAnalysisView3D
Since: ArcGIS Maps SDK for JavaScript 4.30

Represents the analysis view of a ViewshedAnalysis after it has been added to SceneView.analyses.

The ViewshedAnalysisView3D is responsible for rendering a ViewshedAnalysis using custom visualizations.

It allows to create new viewsheds interactively using the place() method, or to make existing viewsheds selectable and editable by enabling the interactive property. To select a viewshed, hover and click on its field-of-view manipulators.

The view for an analysis can be retrieved using SceneView.whenAnalysisView similar to how layer views are retrieved for layers using SceneView.whenLayerView.

// create new analysis and add it to the view
const viewshedAnalysis = new ViewshedAnalysis();
sceneView.analyses.add(viewshedAnalysis);

// retrieve analysis view
const viewshedAnalysisView = await view.whenAnalysisView(viewshedAnalysis);
See also

Property Overview

Name Type Summary Class

The viewshed analysis object associated with the analysis view.

ViewshedAnalysisView3D

Enables interactivity for the analysis.

ViewshedAnalysisView3D

The selected viewshed.

ViewshedAnalysisView3D

The analysis view type.

ViewshedAnalysisView3D

When true, the analysis is visualized in the view.

ViewshedAnalysisView3D

Property Details

analysis

Property
analysis ViewshedAnalysisreadonly

The viewshed analysis object associated with the analysis view.

interactive

Property
interactive Boolean

Enables interactivity for the analysis. When set to true and the analysis includes any valid viewsheds, they become selectable and editable.

Default Value:false

selectedViewshed

Property
selectedViewshed Viewshed |null |undefined

The selected viewshed. If interactive is true, any viewshed in the analysis can be selected by clicking on it in the view. As long as interactive remains true, the properties of the selected viewshed can be edited by interacting with manipulators in the view.

type

Property
type Stringreadonly

The analysis view type.

For ViewshedAnalysisView3D the type is always "viewshed-view-3d".

visible

Property
visible Boolean

When true, the analysis is visualized in the view.

Method Overview

Name Return Type Summary Class
Promise<void>

Starts the interactive creation of new viewsheds and adds them to the analysis.

ViewshedAnalysisView3D

Starts the interactive placement of a single viewshed, adding it to the analysis.

ViewshedAnalysisView3D

Method Details

createViewsheds

Method
createViewsheds(options){Promise<void>}

Starts the interactive creation of new viewsheds and adds them to the analysis.

The first click in the scene places the observer point and the second sets the viewshed's orientation and distance.

The creation process will finish when the user double-clicks the mouse or presses the escape key. To stop the creation programmatically, pass an abort signal as an argument when calling the method.

This method is similar to the place() method, but it allows to create multiple viewsheds in a row.

Calling this method sets interactive to true.

Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene. This behavior is subject to change in a future release.

Parameters
options Object|null
optional

An object specifying additional options.

Specification
optional

Abort signal which can be used to cancel creation.

Returns
Type Description
Promise<void> A promise which resolves when creation is completed successfully or rejected if it is canceled.
Example
const abortController = new AbortController();

try {
  await viewshedAnalysisView.createViewsheds({ signal: abortController.signal });
} catch (error) {
  if (error.name === "AbortError") {
    console.log("Creation operation was cancelled.");
  }
}

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

place

Method
place(options){Promise<ViewshedPlacementResult>}
Since: ArcGIS Maps SDK for JavaScript 4.33 ViewshedAnalysisView3D since 4.30, place added at 4.33.

Starts the interactive placement of a single viewshed, adding it to the analysis.

The first click in the scene places the observer point and the second sets the viewshed's orientation.

The placement operation will finish when the user presses the escape key. To stop the placing programmatically, pass an abort signal as an argument when calling the method.

Calling this method sets interactive to true.

Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene. This behavior is subject to change in a future release.

Parameters
optional

An object specifying additional options.

Specification
optional

Abort signal which can be used to cancel the operation.

Returns
Type Description
Promise<ViewshedPlacementResult> A promise which resolves when the operation is completed successfully or rejected if it is canceled.
Example
const abortController = new AbortController();

try {
  await analysisView.place({ signal: abortController.signal });
} catch (error) {
  if (error.name === "AbortError") {
    console.log("Placement operation was cancelled.");
  }
}

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

Type Definitions

ViewshedPlacementResult

Type Definition
ViewshedPlacementResult

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.