Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Load Data from a KML File

This example demonstrates how to load vector items from a KML file.

To accomplish this, do the following.

View Example

using DevExpress.XtraMap;
using System;
using System.Windows.Forms;

namespace WinForms_MapControl_KmlFileDataAdapter {
    public partial class Form1 : Form {
        const string filePath = "../../kmlFile.kml";

        VectorItemsLayer KmlLayer { get { return (VectorItemsLayer)mapControl1.Layers["KmlLayer"]; } }

        public Form1() {
            InitializeComponent();

            #region #KmlFileDataAdapter
            // Create a KML file data adapter.
            Uri baseUri = new Uri(System.Reflection.Assembly.GetEntryAssembly().Location);
            KmlLayer.Data =  new KmlFileDataAdapter() {
                FileUri = new Uri(baseUri, filePath)
            };
            #endregion #KmlFileDataAdapter
        }
    }
}