Scene layer selection

View inAndroidFormsUWPWPFWinUIiOSView on GitHubSample viewer app

Identify features in a scene to select.

Image of scene layer selection

Use case

You can select features to visually distinguish them with a selection color or highlighting. This can be useful to demonstrate the physical extent or associated attributes of a feature, or to initiate another action such as centering that feature in the scene view.

How to use the sample

Click on a building in the scene layer to select it. Deselect buildings by clicking away from the buildings.

How it works

  1. Create an ArcGISSceneLayer passing in the URL to a scene layer service.
  2. Wait for the user to tap with the sceneView.GeoViewTapped event and get the tapped screen point.
  3. Call sceneView.IdentifyLayersAsync(sceneLayer, screenPoint, tolerance, false, 1) to identify features in the scene.
  4. From the resulting IdentifyLayerResult, get the list of identified GeoElements with result.GeoElements.
  5. Get the first element in the list, checking that it is a feature, and call sceneLayer.SelectFeature(feature) to select it.

Relevant API

  • ArcGISSceneLayer
  • Scene
  • SceneView

About the data

This sample shows a Brest, France Scene hosted on ArcGIS Online.

Tags

3D, Brest, buildings, identify, model, query, search, select

Sample Code

SceneLayerSelection.xamlSceneLayerSelection.xamlSceneLayerSelection.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
<UserControl x:Class="ArcGISRuntime.WPF.Samples.SceneLayerSelection.SceneLayerSelection"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:SceneView x:Name="MySceneView" GeoViewTapped="SceneViewTapped" />
        <Border Style="{StaticResource BorderStyle}">
            <TextBlock FontWeight="SemiBold"
                       Text="Tap to select buildings."
                       TextAlignment="Center" />
        </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.