Viewshed (Spatial Analyst)

Summary

Determines the raster surface locations visible to a set of observer features.

The Geodesic Viewshed tool provides enhanced functionality or performance.

Learn more about how Viewshed works

Illustration

Viewshed illustration
Viewshed output displayed on a hillshaded elevation surface

Usage

  • Determining observer points is a computer-intensive process. The processing time is dependent on the resolution. For preliminary studies, you can use a coarser cell size to reduce the number of cells in the input. Use the full-resolution raster when the final results are ready to be generated.

  • If the input raster contains undesirable noise caused by sampling errors, you can smooth the raster with a low-pass filter, such as the Mean option of the Focal Statistics tool, before running this tool.

  • The visibility of each cell center is determined by comparing the altitude angle to the cell center with the altitude angle to the local horizon. The local horizon is computed by considering the intervening terrain between the point of observation and the current cell center. If the point lies above the local horizon, it is considered visible.

  • An optional above ground level (AGL) output raster is provided by the tool. Each cell on the AGL output raster records the minimum height that needs to be added to that cell to make it visible by at least one observer.

    When the input observer features contain multiple observers, the output value is the minimum of the AGL values from all of the individual observers.

  • When the input raster needs to be resampled, the bilinear technique will be used. An example of when an input raster may be resampled is when the output coordinate system, extent, or cell size is different from that of the input.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Parameters

LabelExplanationData Type
Input raster

The input surface raster.

Raster Layer
Input point or polyline observer features

The feature class that identifies the observer locations.

The input can be point or polyline features.

Feature Layer
Z factor
(Optional)

The number of ground x,y units in one surface z-unit.

The z-factor adjusts the units of measure for the z-units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface.

If the x,y units and z-units are in the same units of measure, the z-factor is 1. This is the default.

If the x,y units and z-units are in different units of measure, the z-factor must be set to the appropriate factor or the results will be incorrect. For example, if the z-units are feet and the x,y units are meters, use a z-factor of 0.3048 to convert the z-units from feet to meters (1 foot = 0.3048 meter).

Double
Use earth curvature corrections
(Optional)

Specifies whether correction for the earth's curvature will be applied.

  • Unchecked—No curvature correction will be applied. This is the default.
  • Checked—Curvature correction will be applied.
Boolean
Refractivity coefficient
(Optional)

The coefficient of the refraction of visible light in air.

The default value is 0.13.

Double
Output above ground level raster
(Optional)

The output above ground level (AGL) raster.

The AGL result is a raster where each cell value is the minimum height that must be added to an otherwise nonvisible cell to make it visible by at least one observer.

Cells that were already visible will have a value of 0 in this output raster.

Raster Dataset

Return Value

LabelExplanationData Type
Output raster

The output raster.

The output will only record the number of times that each cell location in the input surface raster can be seen by the input observation points (or vertices for polylines). The observation frequency will be recorded in the VALUE item in the output raster's attribute table.

Raster

Viewshed(in_raster, in_observer_features, {z_factor}, {curvature_correction}, {refractivity_coefficient}, {out_agl_raster})
NameExplanationData Type
in_raster

The input surface raster.

Raster Layer
in_observer_features

The feature class that identifies the observer locations.

The input can be point or polyline features.

Feature Layer
z_factor
(Optional)

The number of ground x,y units in one surface z-unit.

The z-factor adjusts the units of measure for the z-units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface.

If the x,y units and z-units are in the same units of measure, the z-factor is 1. This is the default.

If the x,y units and z-units are in different units of measure, the z-factor must be set to the appropriate factor or the results will be incorrect. For example, if the z-units are feet and the x,y units are meters, use a z-factor of 0.3048 to convert the z-units from feet to meters (1 foot = 0.3048 meter).

Double
curvature_correction
(Optional)

Specifies whether correction for the earth's curvature will be applied.

  • FLAT_EARTHNo curvature correction will be applied. This is the default.
  • CURVED_EARTHCurvature correction will be applied.
Boolean
refractivity_coefficient
(Optional)

The coefficient of the refraction of visible light in air.

The default value is 0.13.

Double
out_agl_raster
(Optional)

The output above ground level (AGL) raster.

The AGL result is a raster where each cell value is the minimum height that must be added to an otherwise nonvisible cell to make it visible by at least one observer.

Cells that were already visible will have a value of 0 in this output raster.

Raster Dataset

Return Value

NameExplanationData Type
out_raster

The output raster.

The output will only record the number of times that each cell location in the input surface raster can be seen by the input observation points (or vertices for polylines). The observation frequency will be recorded in the VALUE item in the output raster's attribute table.

Raster

Code sample

Viewshed example 1 (Python window)

This example determines the surface locations visible to a set of observers defined in a shapefile.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outViewshed = Viewshed("elevation","observers.shp",2,"CURVED_EARTH",0.15)
outViewshed.save("C:/sapyexamples/output/outvwshd01")
Viewshed example 2 (stand-alone script)

This example determines the surface locations visible to a set of observers defined in a shapefile.

# Name: Viewshed_Ex_02.py
# Description: Determines the raster surface locations visible to a set of
#              observer features.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "elevation"
inObserverFeatures = "observers.shp"
zFactor = 2
useEarthCurvature = "CURVED_EARTH"
refractivityCoefficient = 0.15

# Execute Viewshed
outViewshed = Viewshed(inRaster, inObserverFeatures, zFactor, 
                       useEarthCurvature, refractivityCoefficient)

# Save the output 
outViewshed.save("C:/sapyexamples/output/outvwshd02")

Related topics