KML

Keyhole Markup Language (KML), is an Extensible Markup Language (XML) grammar and file format for modeling and storing geographic features such as points, lines, images, and polygons. Using KML, you can also designate text, pictures, movies, or links to other geographic information system (GIS) services that appear when the user clicks the feature. Many KML client applications, including the ArcGIS Runtime SDK for WPF applications, provide a familiar, user-friendly navigation experience.

Considerations for using KML in your map

KML was originally created to view features in three-dimensional (3D) Earth browsers such as Google Earth. It is now supported in a number of two-dimensional (2D) clients including ArcGIS Runtime SDK for WPF applications. There are some aspects of KML that do not work well on 2D screens and some limitations to what clients can support. For more information, refer to the Supported KML tags section of the KmlLayer class topic.

Adding KML

You can add KML in Extensible Application Markup Language (XAML). They should be inserted inside a Map control element below any base layers. If you have not already done so, create a Windows Presentation Foundation (WPF) application with a map (see Creating a map for details).

NoteNote:

The code in this topic requires a reference to the ESRI.ArcGIS.Client and ESRI.ArcGIS.Client.Toolkit.Datasources assemblies. The XAML of the window (for example, MainWindow.xaml) needs to have the following XML namespace declaration:

xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
  1. In the Map element, add a KmlLayer with an ID of KmlLayer and a uniform resource locator (URL) as the URL for your KML layer. Place this below any data that displays beneath the KML as shown in the following code sample:
    <esri:Map x:Name="_map" Extent="-122.090, 37.419,-122.079,37.424" >
                <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" 
                        Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
                <esri:KmlLayer ID="KmlLayer" Url="http://kml-samples.googlecode.com/svn/trunk/KML_Samples.kml" />
    </esri:Map>
    
  2. Run the application.
1/27/2015