Analysis objects

This sample demonstrates how you can instantiate an analysis object for the following types:

These objects can be added to SceneView.analyses, a collection of client side analyses. This allows for measuring, slicing and performing visibility analyses programmatically without the use of widgets. Further, these objects can be passed to the constructor of widgets and view models in order to set their initial state.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Example Slice Analysis Object
const shape = new SlicePlane({
  position: {
    spatialReference: { wkid: 102100 },
    x: -8238840,
    y: 4971700,
    z: 21
  },
  tilt: 0,
  width: 70,
  height: 70,
  heading: 280
});
const sliceAnalysis = new SliceAnalysis({
  title: "sliceAnalysis",
  shape: shape
});

// Add slice analysis object to slice widget
const widget = new Slice({ view: view, analysis: sliceAnalysis });
view.ui.add(widget, "bottom-right");

For using AreaMeasurementAnalysis Object see also the sample Area measurement analysis object.

The sample also shows how to create a custom UI element to interactively add and edit the viewshed analysis.

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