TutorialViewshed Analysis Tutorial

This topic describes the ENVI Viewshed Analysis workflow. See the following sections:

You can also write a script to perform viewshed analysis using the RasterViewshed task.


Viewshed analysis refers to the process of identifying locations that are visible from one or more observer points. Viewshed analysis 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:

  • Height: The height (in meters) of the observer point
  • Horizontal field of view: The angle (in degrees) of the horizontal range of the observer point.
  • Azimuth: The angle (in degrees) clockwise from North. It sets the horizontal orientation of the observer point.
  • Vertical field of view: The angle (in degrees) of the vertical range of the observer point.
  • Pitch: The verticle pointing angle (in degrees) of the observer point's line of sight. A positive pitch value is above the horizon, and a negative pitch value is below the horizon.

To properly model a restricted line-of-sight analysis, you need to take into account these view constraints. The following diagram illustrates these concepts:

A gridded digital elevation model (DEM) provides 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.

Select Input Files

In the File Selection panel, choose a DEM file for Viewshed Analysis. You can optionally choose an image file to overlay the DEM file, to assist with selecting the view sources.

The input DEM must have a standard spatial reference, not a pseudo spatial reference. The optional input image cannot have a pseudo spatial reference.

  1. From the Toolbox, select Terrain > Viewshed Analysis Workflow and select a DEM File. See The File Selection dialog for details.

    If you select a multi-band DEM file, click to select the band you want to use.

  2. Enter the path and filename for the optional Image File. See The File Selection dialog for details.

  3. To apply a mask, select the Input Mask tab in the File Selection panel.
  4. Click Next. The Viewshed Analysis panel appears, and the files open in a new workflow view.

Define View Parameters

In the Viewshed Analysis panel, set the default view parameters to use for viewshed analysis. Then add point, polyline, or polygon view sources in the workflow view. You can also use previously defined view sources.

Set Default View Parameters

The following parameters are optional and provide a convenient way to define default values for all new view sources that you add. These values do not apply to existing view sources, including those that you restore from a previous session.

  1. Enter the Default Range, in meters, to specify the range of analysis for each view source. Any locations outside this radius will be defined as unclassified. Enter a range that is at least three DEM pixels in size. You can set a different default range at any time; the new default only affects view sources you add after the change.
  2. Enter the Default Viewing Height, in meters, to specify the viewing height for each view source to use when calculating visible areas. You can set a different default height at any time; the new default only affects view sources you add after the change.
  3. If you will be using polylines or polygons for view sources, set the Default Point Spacing, in pixels. Individual view points are automatically generated along polylines or inside polygons using this value, and the number of generated points appears in the Total Points field. You can set a different default point spacing at any time; the new default only affects polylines or polygons you add after the change. A closer point spacing generates more view points along lines and within polygons. This provides a more accurate result, but also a longer processing time.

You can also set these values for individual view sources by editing their properties.

Add View Sources

Each view source is represented by one or more points. It represents the area that has a view to the terrain of interest.

Points are the default view source when the Viewshed Analysis panel appears. The Symbol Annotation tool Symbol Annotation is already selected in the ENVI toolbar so that you can start adding points. Click on the desired spot in the image to add a new point-based view source.

A polygon or polyline is one view source that is approximated by multiple points. To define a polyline view source, select the Polyline Annotation tool Polyline Annotation in the ENVI toolbar and click in the image to create the line. When finished, right-click and select Accept. To view the generated points, click Show Point Spacing Show Point Spacing.

To define a polygon view source, select one of the following tools in the ENVI toolbar:

  • Polygon Annotation Polygon Annotation
  • Rectangle Annotation
  • Ellipse Annotation Ellipse Annotation

Click, or click and drag, in the image to create the polygon. To complete the line, right-click and select Accept. To view the generated points, click Show Point Spacing Show Point Spacing.

The Total Points field updates to show the total number of individual view points for which viewsheds will be calculated.

Set Visibility Options

As you add new view sources, use the Visible From section of the Viewshed Analysis panel to specify what should be visible in the viewshed output, relative to the view sources. The following options are available.

Any Source

If you add only one point-based view source, this is the default option. The viewshed output will show only what is visible from that source.

If you add two or more points—or a polyline or polygon that consists of multiple view points—the green pixels in the viewshed output will represent locations that are visible from at least one of the sources.

  • Example 1: Four observers will be positioned to maximize surveillance coverage of an area. Place four points and select Any Source to see the area that will be visible to at least one of the observers.
  • Example 2: A sightseer wants to select which road to drive along to maximize the amount of an area she will see. Trace a road with a polyline and select a point spacing and view radius. Select Any Source to show all of the areas that will be visible at some point along the drive.
  • Example 3: An observer would like to know the area that will be visible from an area of higher ground. Create a polygon to select the area of higher ground and select a point spacing and analysis radius. Select Any Source to see all locations that can be seen by an observer that is free to move anywhere within the polygon.

All Sources

If you add two or more points, the viewshed output will show what is visible from all of the points. If you add a polyline or polygon, the green pixels in the viewshed output will show what is visible from any point along the polyline or within the polygon. In the case of multiple polylines and/or polygons, as long as one of the points in each view source can see a location, that location will be colored green.

  • Example 1: A communications facility must be positioned to have a direct line of sight to three locations. Place three points and select All Sources to see candidate locations that will be directly visible to all view sources.
  • Example 2: A group of hikers are walking along a trail and will be staying in a hut that is off the trail. They know from field reports that the hut is partially obscured by terrain. They would like to know locations on the road from which they have the best chance of seeing the hut. Draw a line along the trail and select a suitable point spacing. Place a point or polygon at the location of the hut and select a view radius that lies across the road. Select All Sources and find points that are visible from the road and the hut.

All Points Within Sources

This option only pertains to polyline and polygon view sources. When you select this option, the green pixels in the viewshed output represent locations that are visible within the polygon or along the polyline.

Tip: While selecting closer point spacing may increase the accuracy of the viewshed, closer point spacing and larger analysis radius may significantly increase the processing time.

  • Example 1: A phone company would like to place a communications tower such that it has and unobstructed view to all locations on a section of road. Trace a road with polyline and select All Points Within Sources to show candidate tower locations that are visible to all points along the stretch of road.
  • Example 2: A hiker would like to find an overlook point that will give them a full unobstructed view of a lake. Create a polygon tool to select the lake. Select All Points Within Sources to show any terrain that has a direct line of sight to all points on the lake.

Manage View Sources

To move a point, polyline, or polygon source, click the Select tool Select from the toolbar and click and drag the view source to a new location. If the view source is a polyline or polygon, click Show Point Spacing Show Point Spacing to update the location of the generated points.

To delete a view source, select it in the Image window and click the Delete Selected View Source button Delete Selected View Source, or right-click on it in the View Sources list and select Delete. You cannot undo deleting a view source.

To delete all view sources in the list, click the Delete All View Sources button .

To save the view sources to a shapefile, click the Save View Sources button Save View Sources. Separate shapefiles are created for point sources, polyline sources, and polygon sources, with names ending in name_Point.shp, name_Line.shp, name_Poly.shp.

Set View Source Properties

To set or edit the properties of any given view source, select the view source and click the Edit View Source Parameters button Edit View Source Parameters. Or, double-click the view source in the View Sources list.

See the Background section for definitions of Height, Horizontal Field of View, Vertical Field of View, Azimuth, and Pitch. These properties only apply to point view sources.

Preview Results

To preview how the viewshed result will look before processing, enable the Preview check box. A Preview Window appears. The Preview Window works with full or higher resolution views. You can change the view sources and preview the results again, as needed. If either the image lines or samples is greater than 1024 pixels and you want to zoom out of the data, you cannot zoom out further than 50% because it will significantly increase processing time and delay the previewed data from displaying. Zooming out further than 50% will result in a black Preview Window.

Restore View Sources

You can restore view sources from a file that was created in the Viewshed Analysis workflow, or from a point, polygon, or polyline shapefile that was created in another application.

Restored view sources will be added to created ones, if present. Native viewshed shapefiles will be restored with the previously saved range, height, and point spacing attributes. Shapefiles from other applications will be restored with the current default attributes, so you many need to change the defaults before you restore the file.

  1. If you are restoring a shapefile and want to apply different viewshed parameters to the restored view sources, change the Default Range, Default Viewing Height, and Default Point Spacing values as needed.
  2. Click the Restore View Sources button Restore View Sources. The Select View Source File dialog appears.
  3. Click Open File, select one or more shapefiles, and click Open.
  4. Select which view source file(s) to display and click OK. You can load the files individually, or use the Ctrl or Shift keys to select multiple files.

Export Viewshed Analysis Results

  1. Click Next in the Viewshed Analysis panel to proceed to the Export panel.
  2. In the Export Files tab, enable the output options. The following are available:
    • Export Viewshed Image saves the viewshed analysis to an ENVI raster image. Visible areas will be displayed in green, and non-visible or undetermined areas will be displayed in red.
    • Export Viewshed Vectors saves the vectors created during viewshed to a shapefile. The output area units are in square meters.
  3. In the Additional Export tab, enable any other output options. The following are available:
    • Export View Range Vectors saves the vectors created for the viewshed analysis area (view range) to a shapefile. In the shapefile, each view source has a separate polygon record representing the analysis area for that source. You can use this output to show areas that were not included in the analysis and to predict the impact of point spacing along, or within, the source.
    • Export Individual Viewshed Vectors saves the individual source viewsheds to shapefiles. Provide a directory name with an optional file prefix. Each shapefile will have a unique name based on the source name. For example, if the source name is View 1 and you entered C:\VS_ into the output directory field, then the shapefile name will be C:\VS_View_1.shp.
  4. Click Finish to create the output, add the new layers to the Layer Manager and save the files. When the export is complete, the workflow view closes. The original data and the export data display in the Image window view.


Franklin, W.R., C. K. Ray, and S. Mehta. Geometric Algorithms for Siting of Air Defense Missile Batteries, Technical Report DAAL03-86-D-0001 (1994), Battelle, Columbus Division, Columbus, OH, 129 p.

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

See Also

Calculate Viewshed Analysis (ENVI LiDAR), Viewshed Analysis Tutorial