Identify KML features
Show a callout with formatted content for a KML feature.
A user may wish to select a KML feature to view relevant information about it.
Tap a feature to identify it. Feature information will be displayed in a callout.
Note: the KML layer used in this sample contains a screen overlay. The screen overlay contains a legend and the logos for NOAA and the NWS. You can't identify the screen overlay.
- Create a listener for the
GeoViewTappedevent of the
- On tap:
- Dismiss the
Callout, if one is showing.
IdentifyLayersAsync(...)passing in the
KmlLayer, screen point and tolerance.
- Await the result of the identify and then get the
KmlPlacemarkfrom the result.
- Create a callout at the calculated map point and populate the callout content with text from the placemark's
BalloonContent. NOTE: KML supports defining HTML for balloon content and may need to be converted from HTML to text.
- Show the callout.
- Dismiss the
Note: There are several types of KML features. This sample only identifies features of type
This sample shows a forecast for significant weather within the U.S. Regions of severe thunderstorms, flooding, snowfall, and freezing rain are shown. Tap the features to see details.
KML features can have rich HTML content, including images.
Keyhole, KML, KMZ, NOAA, NWS, OGC, weather
<?xml version="1.0" encoding="utf-8" ?> <ContentPage x:Class="ArcGISRuntimeXamarin.Samples.IdentifyKmlFeatures.IdentifyKmlFeatures" 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"> <StackLayout Orientation="Vertical"> <Label Text="Tap to identify features." VerticalOptions="Start" /> <esriUI:MapView x:Name="MyMapView" VerticalOptions="FillAndExpand" /> </StackLayout> </ContentPage>