Line Of Sight (3D Analyst)
Summary
Determines the visibility of sight lines over a surface defined by a multipatch, raster, TIN, terrain, or LAS dataset.
Usage
-
Only the endpoints of the input line are used to define the observer and target. Ideally, sight lines should be simple, straight lines comprised of two vertices representing the observation point and the target location to which visibility is determined.
If the observation location is identified by point features and the target locations reside in a different feature class, use Construct Sight Lines to generate input for this tool.
Consider specifying the optional obstruction point feature to identify the location of the first obstacle blocking the target's visibility for each line.
The output line feature's attribute table contains the following fields:
- SourceOID—The unique ID of the line feature used in calculating visibility.
- VisCode—The visibility along the line. A value of 1 indicates visible, and a value of 2 indicates not visible. This field will only exist if the output geometry is a line.
- TarIsVis—The target visibility along the line. A value of 1 indicates visible, and a value of 0 indicates not visible. This field will only exist if the output geometry is a line.
- OBSTR_MPID—The unique ID of the multipatch that obstructs the line of sight. If no multipatch obstructs the line of sight, then the field contains a value of -1 or -9999. If the target is obstructed by the surface, the value will be -1. If the target is visible, the value will be -9999.
Syntax
Parameter | Explanation | Data Type |
in_surface |
The raster, TIN, terrain, or LAS dataset that defines the surface used in determining visibility. | Raster Layer; Terrain Layer; TIN Layer |
in_line_feature_class |
The line features whose first vertex defines the observation point and last vertex identifies the target location. Height of the observation and target locations are obtained from the z-values of 3D features and interpolated from the surface for 2D features. 2D lines also have a default offset of 1 added to their elevation to raise the points above the surface. If the feature has an OffsetA field, its value will be added to the height of the observation point. If the OffsetB field is present, its value will be added to the height of the target position. | Feature Layer |
out_los_feature_class |
The output line feature class along which visibility has been determined. Two attribute fields are created. VisCode indicates visibility along the line, 1 being visible and 2 not visible. TarIsVis indicates the target visibility, 0 being not visible and 1 being visible. | Feature Class |
out_obstruction_feature_class (Optional) |
An optional point feature class identifying the location of the first obstruction on the observer's sight line to its target. | Feature Class |
use_curvature (Optional) |
Indicates whether the earth's curvature should be taken into consideration for the line-of-sight analysis. For this option to be enabled, the surface needs to have a defined spatial reference in projected coordinates with defined z-units.
| Boolean |
use_refraction (Optional) |
Indicates whether atmospheric refraction should be taken into consideration when generating a line of sight from a functional surface.
| Boolean |
refraction_factor (Optional) |
Provides a value to be used in the refraction factor. The default refraction factor is 0.13. | Double |
pyramid_level_resolution (Optional) |
The resolution of the terrain dataset pyramid level to use for geoprocessing. The default is 0, or full resolution. | Double |
in_features (Optional) |
An optional multipatch feature class that may define additional obstructing elements, such as buildings. | Feature Layer |
Code Sample
The following sample demonstrates the use of this tool in the Python window:
import arcpy
from arcpy import env
arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.LineOfSight_3d("tin", "line.shp", "los.shp", "buldings_multipatch.shp",
"obstruction.shp")
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''*********************************************************************
Name: Sight Line Visibility
Description: This script demonstrates how to calculate visibility
for sight lines against the obstructions presented by
terrain elevation & building models in a multipatch.
*********************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback
from arcpy import env
try:
arcpy.CheckOutExtension('3D')
# Set Local Variables
env.workspace = 'C:/data'
obs_pts = "Observers.shp"
target = "Observation_Targets.shp"
sight_lines = "in_memory/sightlines"
surface = "sample.gdb/elevation/terrain"
buildings = "city_buildings.shp"
outLOS = arcpy.CreateUniqueName("Line_of_Sight.shp")
obstruction_pts = arcpy.CreateUniqueName("Obstruction_Points.shp")
arcpy.AddMessage("Constructing sight lines...")
arcpy.ddd.ConstructSightLines(obs_pts, target, sight_lines)
arcpy.AddMessage("Calculating line of sight...")
arcpy.ddd.LineOfSight(surface, sight_lines, outLOS, obstruction_pts,
"CURVATURE", "REFRACTION", 0.35, 0, buildings)
arcpy.GetMessages(0)
arcpy.CheckInExtension("3D")
except arcpy.ExecuteError:
print arcpy.GetMessages()
except:
# Get the traceback object
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# Concatenate error information into message string
pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
.format(tbinfo, str(sys.exc_info()[1]))
msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
# Return python error messages for script tool or Python Window
arcpy.AddError(pymsg)
arcpy.AddError(msgs)