Line Of Sight (3D Analyst)

Summary

This tool uses an input 2D or 3D polyline feature class along with a raster, triangulated irregular network (TIN), or terrain dataset surface to determine visibility between observer and target points. A multipatch feature class can optionally be supplied to participate in the visibility analysis.

Learn more about how Line of Sight (3D Analyst) works

Usage

Syntax

LineOfSight_3d (in_surface, in_line_feature_class, out_los_feature_class, {out_obstruction_feature_class}, {use_curvature}, {use_refraction}, {refraction_factor}, {pyramid_level_resolution}, {in_features})
ParameterExplanationData Type
in_surface

The input raster, TIN, or terrain surface on which calculations are based.

TIN Layer; Raster Layer; Terrain Layer
in_line_feature_class

The input polyline feature class along which visibility is calculated. This can be a 2D or 3D feature class.

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)

The output point feature class indicating the first obstruction point along the line of sight if the target is not visible.

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.

  • CURVATUREThe earth's curvature will be taken into consideration.
  • NO_CURVATUREThe earth's curvature will not be taken into consideration. This is the default.
Boolean
use_refraction
(Optional)

Indicates whether atmospheric refraction should be taken into consideration when generating a line of sight from a functional surface.

  • NO_REFRACTION Atmospheric refraction will not be taken into consideration. This is the default.
  • REFRACTIONAtmospheric refraction will be taken into consideration.
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, full resolution.

Double
in_features
(Optional)

A feature class of multipatches which may obstruct the line(s) of sight. Default is blank.

Feature Layer

Code Sample

Line Of Sight Example 1 (Python window)

The following Python Window script demonstrates how to use the Line Of Sight function in immediate mode.

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")
Line Of Sight Example 2 (stand-alone script)

The following Python script demonstrates how to use the Line Of Sight function in a stand-alone 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)

Environments

Related Topics

Licensing Information

ArcView: Requires 3D Analyst
ArcEditor: Requires 3D Analyst
ArcInfo: Requires 3D Analyst

6/10/2013