Manage analysis with analysis overlays

The Analysis and AnalysisOverlay classes provide fast, dynamic visualization of analysis results in a scene view. These classes allow you to define analyses (such as viewshed, line of sight, or distance measurement) to be performed using data in the current ArcGISScene. Rendered results are updated dynamically as layers are added or removed, features are updated, the camera position changes, and so on.

Scene view showing lines of sight

Add an analysis overlay

One or more analysis objects can be added to an analysis overlay, which is then added to the scene view. The analysis overlay can control result visibility for all analyses it contains, allowing you to manage a set of related analyses as a single overlay displayed in the view. A scene view can contain several analysis overlays.

  1. Create a new AnalysisOverlay to contain one or more analyses. You might use one overlay to contain all the line of sight analyses for a specific observation point, for example.

    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
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    // Create a new analysis overlay.
    AnalysisOverlay linesOfSightOverlay = new AnalysisOverlay();
    
  2. Add the analysis overlay to the scene view's overlay collection. Similar to the graphics overlay collection, a scene view can have zero or several analysis overlays in the collection.

    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
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    // Add the overlay to the scene view.
    sceneView.getAnalysisOverlays().add(linesOfSightOverlay);
    
  3. Add one or more Analysis objects to the overlay. You can add and remove analyses in the overlay whenever you need to.

    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
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    // Add line of sight analysis instances to the overlay.
    linesOfSightOverlay.getAnalyses().add(rooftopToIntersection);
    linesOfSightOverlay.getAnalyses().add(rooftopToWindow);
    

Controlling analysis visibility

Visibility for scene analyses can be toggled on or off for individual analysis classes (a single line of sight analysis, for example) or for an entire analysis overlay. Toggling the visibility for an analysis overlay will affect all the analyses it contains. This allows you to organize your analyses into logical groups and manage their visibility as a single unit.

You can toggle visibility for an individual analysis to show/hide its results, or toggle visibility for the analysis overlay (and all analyses it contains) as a group. You can also remove it from the analysis overlay if you no longer need it, as well as remove the entire overlay from the scene view.

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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Hide an analysis overlay.
rooftopToIntersection.setVisible(false);

// Show the analysis overlay.
linesOfSightOverlay.setVisible(true);

// Remove an analysis from the overlay.
linesOfSightOverlay.getAnalyses().remove(rooftopToIntersection);

// Remove the analysis overlay from the scene view analysis overlay collection.
sceneView.getAnalysisOverlays().remove(linesOfSightOverlay);

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