ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / LineOfSightResult Class / VisibleLine Property
Example

In This Topic
    VisibleLine Property
    In This Topic
    Gets the visible part(s), if any, of the surface profile, from the perspective of the observer point when looking towards the target point.
    Syntax
    Public ReadOnly Property VisibleLine As Polyline
    public Polyline VisibleLine {get;}
    Remarks
    VisibleLine can be null - meaning the sight line is totally obstructed. It will be projected to the LineOfSightParams.OutputSpatialReference or the spatial reference of the surface if LineOfSightParams.OutputSpatialReference is null.
    Example
    Get Line of Sight
    {
      tinLayer = null;
      MapPoint observerPoint = null;
      MapPoint targetPoint = null;
      CIMPointSymbol obstructionPointSymbol = null;
      CIMLineSymbol visibleLineSymbol = null;
      CIMLineSymbol invisibleLineSymbol = null;
    
      var losParams = new LineOfSightParams();
      losParams.ObserverPoint = observerPoint;
      losParams.TargetPoint = targetPoint;
    
      // add offsets if appropriate
      // losParams.ObserverHeightOffset = observerOffset;
      // losParams.TargetHeightOffset = targerOffset;
    
      // add obstruction feature class if appropriate (multipatch)
      //losParams.ObstructionsMultipatchFeatureClass = obsFeatureClass;
    
      // set output spatial reference
      losParams.OutputSpatialReference = MapView.Active.Map.SpatialReference;
    
      LineOfSightResult results = null;
      try
      {
        // Note: Needs QueuedTask to run
        {
          if (tinLayer.CanGetLineOfSight(losParams))
            results = tinLayer.GetLineOfSight(losParams);
        }
      }
      catch (Exception)
      {
        // handle exception
      }
    
      if (results != null)
      {
        bool targetIsVisibleFromObserverPoint = results.IsTargetVisibleFromObserverPoint;
        //These properties are not used. They will always be false
        // results.IsTargetVisibleFromVisibleLine;
        // results.IsTargetVisibleFromInvisibleLine;
    
        if (results.VisibleLine != null)
          MapView.Active.AddOverlay(results.VisibleLine, visibleLineSymbol.MakeSymbolReference());
        if (results.InvisibleLine != null)
          MapView.Active.AddOverlay(results.VisibleLine, invisibleLineSymbol.MakeSymbolReference());
        if (results.ObstructionPoint != null)
          MapView.Active.AddOverlay(results.ObstructionPoint, obstructionPointSymbol.MakeSymbolReference());
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.2 or higher.
    See Also