Line of sight (geoelement)

View inWPFUWPFormsiOSAndroid
View on GitHub

Show a line of sight between two moving objects.

Image of line of sight geoelement

Use case

A line of sight between GeoElements (i.e. observer and target) will not remain constant whilst one or both are on the move.

A GeoElementLineOfSight is therefore useful in cases where visibility between two GeoElements requires monitoring over a period of time in a partially obstructed field of view (such as buildings in a city).

How to use the sample

A line of sight will display between a point on the Empire State Building (observer) and a taxi (target). The taxi will drive around a block and the line of sight should automatically update. The taxi will be highlighted when it is visible. You can change the observer height with the slider to see how it affects the target's visibility.

How it works

  1. Instantiate an AnalysisOverlay and add it to the SceneView's analysis overlays collection.
  2. Instantiate a GeoElementLineOfSight, passing in observer and target GeoElements (features or graphics). Add the line of sight to the analysis overlay's analyses collection.
  3. To get the target visibility when it changes, react to the target visibility changing on the GeoElementLineOfSight instance.

Relevant API

  • AnalysisOverlay
  • GeoElementLineOfSight
  • LineOfSight.TargetVisibility

Offline data

This sample downloads the following items from ArcGIS Online automatically:


3D, line of sight, visibility, visibility analysis

Sample Code

        <esriUI:SceneView x:Name="MySceneView" />
        <Border Style="{StaticResource BorderStyle}">
                <TextBlock Text="Use the slider to change the observer's altitude."
                           TextAlignment="Center" FontWeight="SemiBold" TextWrapping="Wrap" />
                <TextBlock x:Name="StatusLabel"
                           Text="Status: "
                           TextAlignment="Center" Foreground="MidnightBlue" />
                <Slider HorizontalAlignment="Stretch"
                        ValueChanged="HeightSlider_ValueChanged" />