View in MAUI WPF WinUI View on GitHub

Show an exploratory line of sight between two moving objects.

Image of Show exploratory line of sight between geoelements

Use case

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

An ExploratoryGeoElementLineOfSight 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).

Note: This analysis is a form of “exploratory analysis”, which means the results are calculated on the current scale of the data, and the results are generated very quickly but not persisted.

How to use the sample

An exploratory 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 exploratory 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 an ExploratoryGeoElementLineOfSight, passing in observer and target GeoElements (features or graphics). Add the exploratory 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 ExploratoryGeoElementLineOfSight instance.

Relevant API

  • AnalysisOverlay
  • ExploratoryGeoElementLineOfSight
  • ExploratoryLineOfSight.TargetVisibility

Offline data

This sample downloads the following items from ArcGIS Online automatically:

Tags

3D, exploratory line of sight, visibility, visibility analysis

Sample Code

ShowExploratoryLineOfSightBetweenGeoelements.xaml ShowExploratoryLineOfSightBetweenGeoelements.xaml ShowExploratoryLineOfSightBetweenGeoelements.xaml.cs
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGIS.Samples.ShowExploratoryLineOfSightBetweenGeoelements.ShowExploratoryLineOfSightBetweenGeoelements"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui"
xmlns:sampleViewer="clr-namespace:ArcGIS.Resources">
<Grid Style="{DynamicResource EsriSampleContainer}">
<esriUI:SceneView x:Name="MySceneView" Style="{DynamicResource EsriSampleGeoView}" />
<Border Style="{DynamicResource EsriSampleControlPanel}">
<VerticalStackLayout Padding="5" Spacing="5">
<Label x:Name="MyStatusLabel" Text="Status: " />
<Slider x:Name="MyHeightSlider" ValueChanged="MyHeightSlider_ValueChanged" />
</VerticalStackLayout>
</Border>
</Grid>
</ContentPage>