Identify layers

View inWPFUWPFormsiOSAndroid
View on GitHub

Identify features in all layers in a map. MapView supports identifying features across multiple layers. Because some layer types have sublayers, the sample recursively counts results for sublayers within each layer.

IdentifyLayers

How to use the sample

Tap to identify features. An alert will show all layers with features under the cursor.

How it works

  1. The tapped position is passed to MapView.IdentifyLayersAsync
  2. For each IdentifyLayerResult in the results, features are counted.

    • Note: there is one identify result per layer with matching features; if the feature count is 0, that means a sublayer contains the matching features.

Relevant API

  • IdentifyLayerResult
  • MapView.IdentifyLayersAsync
  • IdentifyLayerResult.LayerContent.Name
  • IdentifyLayerResult.SublayerResults

Tags

identify, sublayers, recursive, recursion

Sample Code

IdentifyLayers.xamlIdentifyLayers.xaml.cs
             
1
2
3
4
5
6
7
8
9
10
11
12
13
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             x:Class="ArcGISRuntimeXamarin.Samples.IdentifyLayers.IdentifyLayers">
    <StackLayout Orientation="Vertical">
        <Label Text="Tap to identify features in all layers."
               HorizontalTextAlignment="Center"
               FontAttributes="Bold"
               VerticalOptions="Start" />
        <esriUI:MapView x:Name="MyMapView"
                        VerticalOptions="FillAndExpand" />
    </StackLayout>
</ContentPage>

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