TutorialInteractive Viewshed Analysis Tutorial

This topic describes how to use the interactive Viewshed Analysis tool. See the following sections for details:

You can also write a script to perform viewshed analysis using the RasterViewshed task. The task provides results of viewshed analysis, but is not interactive.

Background


Viewshed analysis is the process of identifying locations that are visible from one or more observer points. It is also called line-of-sight analysis or intervisibility analysis. Here are some common applications of viewshed analysis:

  • A telecommunications company wants to build communication towers with direct lines of sight from one tower to the next.

  • An ecologist wants to set up infrared cameras to monitor their field site for animal activity with the best possible coverage.
  • A military convoy wants to know where it can be seen from the side of the road, or what parts along the road will not be visible to the convoy.

An ideal viewshed would offer an unobstructed view from an observer point (also called a view source) to an object of interest (target) in any direction, where the target is coincident with the ground. However, observer points are often constrained by variables such as:

  • The height of the observer point.
  • The angle of the horizontal range of the observer point.
  • The angle clockwise from North (azimuth), which sets the horizontal orientation of the observer point.
  • The angle of the vertical range of the observer point.

A gridded elevation product such as a DEM, DSM, or DTM will provide the elevation values needed to determine visibility relative to the height above the terrain.

ENVI uses the Izraelevitz (2003) algorithm for viewshed analysis, which is an extension to the original Xdraw algorithm developed by Franklin et al. (1994). The Izraelevitz algorithm performs well in densely sampled terrain elevation models, and it is significantly faster than a radial interpolation method. The Izraelevitz algorithm does not compute a true line-of-sight function but rather an approximation.

Enable the Viewshed Analysis Tool


  1. From the main menu, select File > Open and select a DEM, DSM, or DTM file. If you select a multi-band file, select the band to use. See The Data Selection dialog for details.

  2. You can optionally open a raster to overlay on the gridded elevation layer. This can be useful when selecting observation points. Select File > Open to choose a raster file.

  3. In the ENVI Toolbar, the icon for the Viewshed Analysis tool is enabled when a gridded elevation file is opened. Click the icon to enable the tool.

    ENVI adds an ROI layer called Viewshed Seen Area to the Layer Manager. Areas that can be seen from the observer points are shown in this layer. You can change this in the Show Layers setting of the Viewshed Tool properties to one of these options:

    • Hidden: Show only the areas that cannot be seen from the observer points. When selected, the layer name changes to Viewshed Hidden Area in the Layer Manager.

    • Both: Show areas that can and cannot be seen from the observer points. When selected, the Viewshed Seen Area layer remains in the Layer Manager and a new ROI layer, called Viewshed Hidden Area, is added.

      Tip: The viewshed layers are not attached to rasters in the Layer Manager, which allows you to move them up and down in the layer stack, and independently adjust their level of transparency.

    Properties for the Viewshed Tool are located in the Options tab at the bottom-right of the window. You can edit these settings at any time during viewshed analysis.

You are now ready to add observer points, as described in the next section.

Add Observer Points


You can add observer points on the image in the following ways:

  • As a single observer point that you can move around the image.

  • As one or more fixed paths that have multiple observer points along the path.

  • As one or more fixed areas that contain multiple observer points inside the area.

  • Import vectors from an associated file to use as paths/areas.

You can change any of the settings used for the observer points in the Viewshed Tool properties.

Add an Single Observer Point

To add a single observer point, click on the image to add a yellow vertex (the observer point). The pixels visible from the observer point display in green.

You can change the location of the observer point at any time by clicking on or dragging to a new location. The areas visible from the observer point will refresh as its position changes.

To remove the observer point, right-click and select Clear.

Draw a Path or Area of Observer Points

A path is a polyline of multiple vertices, where each vertex is an observer point. You can create these types of paths:

  • Polyline Path

  • Polygon Path

  • Rectangle Path

  • Ellipse Path

In the image below, a Polygon Path was drawn to follow the edge of a rooftop. The yellow vertices are the observer points along the path line and the red vertex is the selected observer point. The green pixels show what is visible from the selected observer point.

An area is a polygon filled with multiple vertices, where each vertex is an observer point. You can create these types of shapes:

  • Filled Polygon

  • Filled Rectangle

  • Filled Ellipse

In the image below, a Filled Polygon was drawn on a rooftop. The yellow vertices are the observer points that fill the area within the polygon and the red vertex is the selected observer point. The green pixels show what is visible from the selected observer point.

You can draw one or multiple paths/areas on the image, and you can use paths and areas in combination to do viewshed analysis.

To create a new path or filled polygon:

  1. Right-click on the image and select New.

  2. Select the type of path or filled polygon to draw from the context menu.

  3. Click at intervals to create the line or shape. If you are drawing a Polygon Path or Filled Polygon, you can use the Magic Wand tool to quickly complete the shape. Press Ctrl+click once on the feature you want to draw, such as a building. ENVI will find the edges of the feature and complete the shape.

  4. Complete the line or shape with one of the following:

    • Double-click to set the end point and accept the line or shape.

    • Right-click and select Complete and accept <type>

    • Right-click and select Complete <type>, then either double-click to accept it, or right-click and select Accept <type>

  5. To start over with drawing, right-click and select Clear <type>.

  6. To add more paths or filled polygons, right-click and select Add > <type>, then repeat the steps above to create the line or shape. (Note that if you right-click and select New, you will lose any polylines or polygons you previously created.)

You can change the interval spacing of the vertices and other settings in the Options tab Vertex Interval property. See Viewshed Tool properties for details.

Add Observer Points from a Vector File

If a vector file is associated with your data, you can use those vectors to create paths or areas. Use the steps below.

  1. Right-click on the image and select New > Vector File. The Select Record Subset dialog appears, with each vector listed in the dialog as a separate row.

  2. Select the rows of for the vectors to import, and click OK. Polylines will be added as a path. Polygons, rectangles, and ellipse will be added as filled areas.

Manually Step Through the Observer Points

You can manually check visibility from each observer point of a path/area as follows:

  • Click an observer point to see what is visible from it.

  • Click to select an observer point, then press the left/right Arrow keys on the keyboard to step forwards or backwards through the points one-by-one. Hold the Arrow key to continuously step through the points. If multiple paths/areas were drawn, you will progressively step through one path/area to the next one.

You can also animate stepping through the points, described in the next section.

Animate the Viewshed Analysis


Use animation to automate stepping through all observer points one-by-one and examine what the viewshed is for each. If multiple paths/areas were drawn, the animation will cycle through each point of one path/area, then automatically move to the next path/area to animate, and so on.

Animation is controlled from this toolbar in the Options tab:

The player buttons do the following:

  • Step Backwards through the observer points, one point per click.
  • Play Backwards animates the observer points as a backward loop, starting with the last point created when the line or shape was drawn and ending with the first point.
  • Pause animation.
  • Play Forwards animates the observer points as a forward loop, starting with the first point created when the line or shape was drawn and ending with the last point.
  • Step Forwards through the observer points, one point per click.
  • Play Back and Forth animates the observer points as a back and forth loop.
  • Save to MPEG saves the animation to an MPEG file. In the Save Viewshed Animation to MPEG dialog that appears, enter the animation duration, provide a location and filename, and click OK.

Generate Full Results and Heatmap


If one or more paths/areas are drawn on the image, you can generate viewshed results to a layer that shows what is and is not visible from all observer points. Choosing this option also generates a heatmap layer that shows how much a given pixel was seen from all observer points.

To generate results for the full viewshed analysis and heatmap:

  1. Right-click and select Full Results. ENVI calculates the viewshed result and adds the layers Full Seen/Hidden Map and Seen Heatmap to the Layer Manager.

  2. The Full Seen/Hidden Map layer overlays the image, with classes Seen (green) and Hidden (red) visible. To view the class for Out of Range, enable the layer in the Layer Manager.

  3. In the Layer Manager, the Seen Heatmap layer is below the Full Seen/Hidden Map in the layer stack. To view it, hide the Full Seen/Hidden Map layer, or move Seen Heatmap above it in the layer stack. The Seen Heatmap is a histogram count of how many times a given pixel was seen and is color-coded. Warm to hot colors represent pixels that were seen the most. Cool to cold colors pixels that were seen the least.

To save the results of the Full Seen/Hidden Map and Seen Heatmap output to files:

  1. Right-click in the view and select Save.

  2. Select the layer to save:

    • "Full Seen/Hidden Map" to File

    • "Seen Heatmap" to File

  3. In the dialog that displays, enter the location and filename.

  4. Click Save.

Viewshed Tool Properties


You can change the Viewshed Tool properties in the Options tab at any point while you are using the tool. The settings will remain throughout the viewshed session, but will revert to the defaults when you exit ENVI.

Range: The range of analysis (in meters) for each observer point. Locations outside this radius will be defined as out-of-range.The default is 250.

Observer Height: The height (in meters) of the observer point. The default is 2.

Observer Azimuth: The horizontal orientation of the observer point. The value is the number of degrees clockwise from North. The default is 0. You can also change the observer azimuth using the Left/Right keyboard keys. The change of orientation will be more noticeable if the Horizontal Field of View is less than 360.

Horizontal Field of View: The horizontal range of the observer point (in degrees). The default is 35. You can also increase/decrease the horizontal field of view using the Up/Down keyboard keys.

Vertical Field of View: The vertical range of the observer point, in degrees. The default is 10.

Vertex Interval: The interval (in meters) at which to space the vertices when using path or filled shapes.

Show Layers: Specifies the layer(s) to show in the View and Layer Manager. Seen, Hidden, Both. The default is Seen.

Show Vertices: Specifies whether to show the observer point vertices. The default is True.

Seen Color: Defines which color to use to show areas that are visible from the observer point. The default is green (0,200,0).

Hidden Color: Defines which color to use to show areas that are hidden from the observer point. The default is red (200,0,0).

Vertex Color: Defines which color to use to use for the vertex, which represents the observer point. The default is yellow (255,255,0).

References


Izraelevitz, D. "A Fast Algorithm for Approximate Viewshed Computation." Photogrammetric Engineering & Remote Sensing 69, No. 7 (2003): 767-774.

See Also


Interactive Viewshed Analysis Tutorial, Calculate Viewshed Analysis (ENVI LiDAR)