Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for .NET

Display KML network links

This code sample is available for these platforms:
View Sample on GitHub

Display a file with a KML network link.

Use case

KML files can reference other KML files on the network as well as refresh intervals. This can be used to create a map that will periodically refresh itself with the latest data. Note that although the base KML file is loaded locally, all of the content is being downloaded from a website every few seconds.

How to use the sample

The sample will load the KML file automatically. The data shown should refresh automatically every few seconds.

Relevant API

  • KmlDataset(Uri)
  • KmlLayer(KmlDataset)

Offline data

This sample uses the radar.kmz file, which can be found on ArcGIS Online.

About the map

This map shows the current air traffic in parts of Europe with heading, altitude, and ground speed. Additionally, noise levels from ground monitoring stations are shown.


KML, KMZ, Network Link

Sample Code

        <esriUI:SceneView x:Name="MySceneView" />
// Copyright 2018 Esri.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Ogc;
using System;
using Windows.UI.Popups;

namespace ArcGISRuntime.UWP.Samples.DisplayKmlNetworkLinks
        "Display KML network links",
        "Display a KML file that loads content from a network resource.",
    public partial class DisplayKmlNetworkLinks
        public DisplayKmlNetworkLinks()

        private void Initialize()
            // Set up the basemap.
            MySceneView.Scene = new Scene(Basemap.CreateImageryWithLabels());

            // Create the dataset.
            KmlDataset dataset = new KmlDataset(new Uri(""));

            // Listen for network link control messages.
            // These should be shown to the user.
            dataset.NetworkLinkControlMessage += Dataset_NetworkLinkControlMessage;

            // Create the layer from the dataset.
            KmlLayer fileLayer = new KmlLayer(dataset);

            // Add the layer to the map.

            // Zoom in to center the map on Germany.
            MySceneView.SetViewpoint(new Viewpoint(new MapPoint(8.150526, 50.472421, SpatialReferences.Wgs84), 20000000));

        private async void Dataset_NetworkLinkControlMessage(object sender, KmlNetworkLinkControlMessageEventArgs e)
            // Due to the nature of the threading implementation,
            //     the dispatcher needs to be used to interact with the UI.
            // The dispatcher takes an Action, provided here as a lambda function.
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
                await new MessageDialog(e.Message, "KML layer message").ShowAsync();