ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / RasterLayer Class / GetLineOfSight Method
The object which contains all input values.

In This Topic
    GetLineOfSight Method (RasterLayer)
    In This Topic
    Performs a line of sight analysis for an observer and target point on the surface. Determines if the target point is visible from a given observer point. This method requires a 3D Analyst license. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    lineOfSightParams
    The object which contains all input values.

    Return Value

    A LineOfSightResult instance.
    Exceptions
    ExceptionDescription
    lineOfSightParams cannot be null.
    A 3D Analyst license is required.
    The set of parameters is invalid for this surface. See CanGetLineOfSight.
    An exception occurred within the Line of Sight calculation.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    See the following links for more information about Line of Sight analysis - https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/line-of-sight.htm and https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/how-line-of-sight-works.htm. Note that the geoprocessing tool uses a feature class of lines for the observer and target inputs whereas this method performs the calculation on a single pair of MapPoints only.

    Use CanGetLineOfSight to determine if the set of input parameters is valid prior to calling this method.

    The elevation of the observer point (let's call it observerZ) is derived as follows. If you provide a Z-aware (3D) observer point, observerZ will be set to its Z value; if you provide a 2D observer point, then observerZ will be set to the Z value of the surface at the XY of the observer point. If you specify an observer height offset, it will be added to observerZ. Similarly with the target point for calculating targetZ.

    GetLineOfSight doesn't always produce all possible results. Internally the function generates an imaginary straight 3D line (the sight line) from the observer point (at observerZ) to the target point (at targetZ). It then interpolates (drapes) this line onto the surface, creating an imaginary profile line. The typical results consist of a "visible" line (possibly a multipart line) representing the portion of the profile line which is visible from the observer point (at observerZ), and an "invisible" line (possibly a multipart line) representing the portion of the profile line which is not visible from the observer point (at observerZ). If the sight line intersects the surface at least once, then an obstruction point is created at the first intersection point which is closest to the observer point.The obstruction point, if one is created, will always lie along the profile line, but will typically not occur at the end of the first visible line part.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also