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
-
The perimeter is sampled uniformly if the target features are lines or polygons.
-
The input feature class must be a point feature class. Multipoints are not valid.
-
A three-dimensional output will be generated if a height source is specified for both observer and target features.
A join field is used to specify one or more targets for a given observer. If no join field is used, all points will be connected to all targets.
The height source of the observer and target features defaults to the first field name encountered in this list:
- Shape.Z (Only available for features that are Z-enabled)
- Spot
- Z
- Z_Value
- Height
- Elev
- Elevation
- Contour
If no suitable height field exists, the <None> keyword will be used by default to indicate the features have no Z-values.
If the desired height field does not have a higher priority in the default field selection, the desired field will need to be explicitly specified. Similarly, if a height field is not desired but the feature class contains one of the fields in the default selection list, the <None> keyword will need to be specified.
The Sampling Distance units should be given in x,y units of output feature class.
The following fields will be added to the output feature class that contains the sight lines:
- OID_OBSERV—The OID of the observer point
- OID_TARGET—The OID of the target feature
- DIST_ALONG—The distance along the target feature if it is a line or polygon
Syntax
Parameter | Explanation | Data 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.
| 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.
| 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
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')
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)