Line Of Sight (3D Analyst)

License Level:BasicStandardAdvanced

Summary

Determines the visibility of sight lines over obstructions consisting of a surface and an optional multipatch dataset.

Learn more about how Line Of Sight works

Illustration

Line of Sight

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 LAS dataset, raster, TIN, or terrain surface used in determining visibility.

LAS Dataset Layer; 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.

  • 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. This option does not apply if multipatch features are used.

  • REFRACTIONAtmospheric refraction will be taken into consideration.
  • NO_REFRACTIONAtmospheric refraction will not be taken into consideration. This is the default.
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 z-tolerance or window-size resolution of the terrain pyramid level that will be used by this tool. The default is 0, or full resolution.

Double
in_features
(Optional)

A multipatch feature that may define additional obstructing elements, such as buildings. Refraction options are not honored for this input.

Feature Layer

Code Sample

LineOfSight 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.LineOfSight_3d("tin", "line.shp", "los.shp", "buldings_multipatch.shp", 
                    "obstruction.shp")
LineOfSight example 2 (stand-alone script)

The following sample demonstrates the use of this tool in a stand-alone Python script:

'''*********************************************************************
Name: Sight Line Visibility of Parade Path
Description: This script demonstrates how to create a sight line feature class
             from a pair of observer and target points.
*********************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback
from arcpy import env

try:
    # Checking out 3D Analyst Extension:
    arcpy.CheckOutExtension('3D')

    # Set Local Variables:
    env.workspace = 'C:/data'

    # Setting up input and output variables:
    obs = "observer_pts.shp"
    tar = "parade_path.shp"
    sightlines = "output_sightlines.shp"
    height = "<None>"
    join_field = "#"
    sampling = 0.5
    direction = "OUTPUT_THE_DIRECTION"
    surface = 'elevation.tif'
    bldgs = 'buildings.shp'

    arcpy.AddMessage("Building sightlines...")
    arcpy.ddd.ConstructSightLines(obs, tar, sightlines, height, height, 
                                  join_field, sampling, direction)
    arcpy.ddd.LineOfSight(surface, sightlines, "Parade_LOS.shp", 
                          "Obstructions.shp", in_features=bldgs)
    
    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

ArcGIS for Desktop Basic: Requires 3D Analyst
ArcGIS for Desktop Standard: Requires 3D Analyst
ArcGIS for Desktop Advanced: Requires 3D Analyst
3/7/2014