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:

Tags

3D, line of sight, visibility, visibility analysis

Sample Code

LineOfSightGeoElement.xamlLineOfSightGeoElement.xaml.cs
                      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.LineOfSightGeoElement.LineOfSightGeoElement"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:SceneView x:Name="MySceneView" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel>
                <TextBlock Text="Use the slider to change the observer's altitude."
                           TextAlignment="Center" FontWeight="SemiBold" TextWrapping="Wrap" />
                <TextBlock x:Name="StatusLabel"
                           Text="Status: "
                           Margin="0,10,0,5"
                           TextAlignment="Center" Foreground="MidnightBlue" />
                <Slider HorizontalAlignment="Stretch"
                        Margin="0,0,0,-10"
                        ValueChanged="HeightSlider_ValueChanged" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.