Construct Sight Lines (3D Analyst)

Summary

Creates line features that represent sight lines from one or more observer points to features in a target feature class.

Usage

Syntax

ConstructSightLines_3d (in_observer_points, in_target_features, out_line_feature_class, {observer_height_field}, {target_height_field}, {join_field}, {sample_distance})
ParameterExplanationData Type
in_observer_points

The single-point features that represent observer points. Multipoint features are not supported.

Feature Layer
in_target_features

The target features (points, multipoints, lines, and polygons).

Feature Layer
out_line_feature_class

The output feature class containing the sight lines.

Feature Class
observer_height_field
(Optional)

The source of the height values for the observer points obtained from its attribute table.

A default Observer Height Field field is selected from among the options listed below by order of priority. If multiple fields exist, and the desired field does not have a higher priority in the default field selection, the desired field will need to be specified. If no suitable height field exists, the <None> keyword will be used. Similarly, if a height field is not desired but the feature class has one of the fields listed below, the <None> keyword will need to be specified.

  1. Shape.Z
  2. Spot
  3. Z
  4. Z_Value
  5. Height
  6. Elev
  7. Elevation
  8. Contour
String
target_height_field
(Optional)

The height field for the target.

A default Target Height Field field is selected from among the options listed below by order of priority. If multiple fields exist, and the desired field does not have a higher priority in the default field selection, the desired field will need to be specified. If no suitable height field exists, the <None> keyword will be used. Similarly, if a height field is not desired but the feature class has one of the fields listed below, the <None> keyword will need to be specified. If no suitable height field exists, the <None> keyword will be used by default.

  1. Shape.Z
  2. Spot
  3. Z
  4. Z_Value
  5. Height
  6. Elev
  7. Elevation
  8. Contour
String
join_field
(Optional)

The join field is used to match observers to specific targets.

String
sample_distance
(Optional)

The distance between samples when the target is either a line or polygon feature class. The Sampling Distance units are interpreted in the XY units of the output feature class.

Double

Code Sample

ConstructSightLines example 1 (Python window)

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.ConstructSightLines_3d('observer_pt.shp', 'target.shp', 
                             'sightlines.shp', 'BASEHEIGHT', 
                             'TOP_HEIGHT', 'NAME')
ConstructSightLines example 2 (stand-alone script)

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)

Environments

Related Topics

Licensing Information

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

6/10/2013