ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Viewshed 2

Available with Spatial Analyst license.

  • Summary
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Determines the raster surface locations visible to a set of observer features, using geodesic methods.

Learn more about how the Viewshed 2 tool works

Usage

  • There are two types of visibility analysis that can be performed by this tool, controlled by the Analysis type parameter. For the first type, FREQUENCY, the tool determines which raster surface locations are visible to a set of observers. For the other, OBSERVERS, it identifies which observers are visible from each raster surface location.

  • This tool can be GPU accelerated, which means that if a GPU device (Graphics Processing Unit) is available on your system, it will be used to enhance the performance of the tool.

    Currently, this tool only supports NVIDIA graphics cards with CUDA compute capability 2.0 or OpenCL 1.2 and is dependent on your system having an appropriate card installed. To ensure proper tool execution, see the NVIDIA driver update pageNVIDIA driver downloads for the latest available driver.

  • A GPU error may be returned and the tool fails to execute if the Windows TdrDelay (Timeout Detection and Recovery Delay) registry key value is too small for the operation. The default value for TdrDelay is 2 seconds, but you may need to adjust it to a larger value, such as 60 seconds. On most Windows systems, the path to the TdrDelay key in the Registry is HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers. If the TdrDelay key does not exist, you must create it in this path and assign it the larger value. You must reboot your machine for the change to take effect. For more details on how to define the TdrDelay registry key, visit the Microsoft TDR Registry Keys web pageMicrosoft.com.

    Caution:

    Esri cannot be responsible for any system problems that may occur if the registry was improperly modified. Be sure to take appropriate steps to ensure that you have a valid registry backup to revert to should any problems be encountered, or have a qualified systems analyst perform the change.

  • Unlike other similar tools, Viewshed 2 does not have a Z factor parameter. To ensure the correctness of the output visibility raster, assign a spheroidal vertical coordinate system to the input raster if it does not already have one.

  • The visibility of each cell center is determined by a line-of-sight test between the target and each observer. If an observer can see the target at the cell center, the cell is considered visible. This tool always considers the curvature of the earth when the visibility is determined.

  • On the output visibility raster, nonvisible cells are assigned NoData.

  • For the OBSERVERS analysis type, the allowed maximum number of input observer points is 32.

  • 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 Focal Statistics, before running this tool.

  • 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.

  • By default, the viewshed will be calculated to the maximum extent of the input dataset. For improved performance, it is recommended to explicitly set the Outer radius parameter to the maximum distance of interest for your analysis. This parameter will allow the tool to perform its computations only on the cells that are within a certain distance to the observers.

  • You can use the Analysis Method parameter to control the quality of and the time it takes to obtain a result. The PERIMETER_SIGHTLINES method is intended for exploratory analysis, as it achieves faster performance at the expense of output quality. To get the most accurate output, use the ALL_SIGHTLINES method.

  • For more details on technical aspects of the implementation of this tool, see the following resource.

    http://support.esri.com/en/knowledgebase/techarticles/detail/42804

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

Syntax

Viewshed2 (in_raster, in_observer_features, {out_agl_raster}, {analysis_type}, {vertical_error}, {out_observer_region_relationship_table}, {refractivity_coefficient}, {surface_offset}, {observer_elevation}, {observer_offset}, {inner_radius}, {inner_radius_is_3d}, {outer_radius}, {outer_radius_is_3d}, {horizontal_start_angle}, {horizontal_end_angle}, {vertical_upper_angle}, {vertical_lower_angle}, {analysis_method})
ParameterExplanationData Type
in_raster

The input surface raster. It can be an integer or a floating-point raster.

The input raster is transformed into a 3D geocentric coordinate system during the visibility calculation. NoData cells on the input raster do not block the visibility determination.

Raster Layer
in_observer_features

The input feature class that identifies the observer locations. It can be point, multipoint, or polyline features.

The input feature class is transformed into a 3D geocentric coordinate system during the visibility calculation. Observers outside of the extent of the surface raster or located on NoData cells will be ignored in the calculation.

Feature Layer
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 be assigned 0 in this output raster.

When the vertical error parameter is 0, the output AGL raster is a one-band raster. When vertical error is greater than 0, to account for the random effects from the input raster, the output AGL raster is created as a three-band raster. The first band represents the mean AGL values, the second band represents the minimum AGL values, and the third band represents the maximum AGL values.

Raster
analysis_type
(Optional)

Choose which type of visibility analysis you wish to perform, either determining how visible each cell is to the observers, or identifying for each surface location which observers are visible.

  • FREQUENCY —The output records the number of times that each cell location in the input surface raster can be seen by the input observation locations (as points or as vertices for polyline observer features). This is the default.
  • OBSERVERS — The output identifies exactly which observer points are visible from each raster surface location. The allowed maximum number of input observers is 32 with this analysis type.
String
vertical_error
(Optional)

The amount of uncertainty (the Root Mean Square error, or RMSE) in the surface elevation values. It is a floating-point value representing the expected error of the input elevation values. When this parameter is assigned a value greater than 0, the output visibility raster will be floating point. In this case, each cell value on the output visibility raster represents the sum of probabilities that the cell is visible to any of the observers.

When the analysis type is OBSERVERS or the analysis method is PERIMETER_SIGHTLINES, this parameter is disabled.

Linear unit
out_observer_region_relationship_table
(Optional)

The output table for identifying the regions that are visible to each observer. This table can be related to the input observer feature class and the output visibility raster for identifying the regions visible to given observers.

This output is only created when the analysis type is OBSERVERS.

Table
refractivity_coefficient
(Optional)

Coefficient of the refraction of visible light in air.

The default value is 0.13.

Double
surface_offset
(Optional)

This value indicates a vertical distance (in surface units) to be added to the z-value of each target cell as it is considered for visibility. It should be a positive integer or floating-point value.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then that value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Linear unit | Field
observer_elevation
(Optional)

This value is used to define the surface elevations of the observer points or vertices.

It can be a field in the input observer features dataset or a numerical value. If this parameter is not specified, the observer elevation will be obtained from the surface raster using bilinear interpolation. If this parameter is set to a value, then that value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Linear unit | Field
observer_offset
(Optional)

This value indicates a vertical distance (in surface units) to be added to observer elevation. It should be a positive integer or floating-point value.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then that value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Linear unit | Field
inner_radius
(Optional)

This value defines the start (minimum) distance from which visibility is determined. Cells closer than this distance are considered not visible in the output but can still block visibility of the cells between the inner radius and the outer radius. The default value is 0.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then the value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Linear unit | Field
inner_radius_is_3d
(Optional)

Type of distance for the inner radius parameter.

  • GROUND —Inner radius is to be interpreted as a 2D distance. This is the default.
  • 3D —Inner radius is to be interpreted as a 3D distance.
Boolean
outer_radius
(Optional)

This value defines the maximum distance from which visibility is determined. Cells beyond this distance are excluded from the analysis.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then the value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Linear unit | Field
outer_radius_is_3d
(Optional)

Type of distance for the outer radius parameter.

  • GROUND —Outer radius is to be interpreted as a 2D distance. This is the default.
  • 3D —Outer radius is to be interpreted as a 3D distance.
Boolean
horizontal_start_angle
(Optional)

This value defines the start angle of the horizontal scan range. The value should be specified in degrees from 0 to 360.0, with 0 oriented to north. The default value is 0.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then the value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Constant | Field
horizontal_end_angle
(Optional)

This value defines the end angle of the horizontal scan range. The value should be specified in degrees from 0 to 360.0, with 0 oriented to north. The default value is 360.0.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then the value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Constant | Field
vertical_upper_angle
(Optional)

This value defines the upper vertical angle limit of the scan above a horizontal plane. The value should be specified in degrees from 0 to 90.0, which can be integer or floating point. The default value is 90.0.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then the value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Constant | Field
vertical_lower_angle
(Optional)

This value defines the lower vertical angle limit of the scan below a horizontal plane. The value should be specified in degrees from -90.0 to 0, which can be integer or floating point. The default value is -90.0.

It can be a field in the input observer features dataset or a numerical value. If this parameter is set to a value, then the value will be applied to all the observers. To specify different values for each observer, set this parameter to a field in the input observer features dataset.

Constant | Field
analysis_method
(Optional)

Choose the method by which the visibility will be calculated. This option allows you to trade some accuracy for increased performance.

  • ALL_SIGHTLINES —A sightline is run to every cell on the raster in order to establish visible areas. This is the default method.
  • PERIMETER_SIGHTLINES — Sightlines are only run to the cells on the perimeter of the visible areas in order to establish visibility areas. This method has a better performance than the ALL_SIGHTLINES method since less sightlines are run in the calculation.
String

Return Value

NameExplanationData Type
out_raster

The output raster.

For the FREQUENCY analysis type, when the vertical error parameter is 0 or not specified, the output raster records the number of times that each cell location in the input surface raster can be seen by the input observation points. When the vertical error parameter is greater than 0, each cell on the output raster records the sum of probabilities that the cell is visible to any of the observers. For the OBSERVERS analysis type, the output raster records the unique region IDs for the visible areas, which can be related back to the observer features through the output observer-region relationship table.

Raster

Code Sample

Viewshed2 example 1 (Python window)

This example determines the surface locations visible to a set of observers without using any observer parameters.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outViewshed2 = Viewshed2("elevation", "obser1.shp", "", "OBSERVERS", "",
                         "C:/sapyexamples/output/obstable01.dbf",
                         analysis_method="ALL_SIGHTLINES")
outViewshed2.save("C:/sapyexamples/output/outvwshd2_01")
Viewshed2 example 2 (stand-alone script)

This example determines the surface locations visible to a set of observers using attributes in the input feature class as the observer parameters.

# Name: Viewshed2_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"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.checkOutExtension("Spatial")

inRaster = "elevation"
inObservers = "obser2.shp"
outAGL = ""
analysisType = "OBSERVERS"
verticalError = ""
outAnalysisRelationTable = "C:/sapyexamples/output/obser_region2.dbf"
refractCoeff = ""
surfaceOffset = "offsetb"
observerElevation = "spot"
observerOffset = "offseta"
innerRadius = "radius1"
innerIs3D = "False"
outerRadius = "radius2"
outerIs3D = "True"
horizStartAngle = "azimuth1"
horizEndAngle = "azimuth2"
vertUpperAngle = "vert1"
vertLowerAngle = "vert2"
analysisMethod = "ALL_SIGHTLINES"

# Execute Viewshed2
outViewshed2 = Viewshed2(inRaster, inObservers, outAGL, analysisType,
                         verticalError, outAnalysisRelationTable, refractCoeff,
                         surfaceOffset, observerElevation, observerOffset,
                         innerRadius, innerIs3D, outerRadius, outerIs3D,
                         horizStartAngle, horizEndAngle, vertUpperAngle,
                         vertLowerAngle, analysisMethod)

# Save the output
outViewshed2.save("C:/sapyexamples/output/outvwshd2_02")

Environments

  • Auto Commit
  • Cell Size
  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • Mask
  • Output CONFIG Keyword
  • Output Coordinate System
  • Parallel Processing Factor
  • Raster Statistics
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing Information

  • ArcGIS for Desktop Basic: Requires Spatial Analyst or 3D Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst or 3D Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst or 3D Analyst

Related Topics

  • An overview of the Surface toolset
  • How Viewshed 2 works
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal