How to: Load Data from a KML File
- 2 minutes to read
This example demonstrates how to load vector items from a KML file.
To accomplish this, do the following.
- Create a VectorItemsLayer object and add it to the Map control’s LayerCollection with the MapControl.Layers property.
- Create a KmlFileDataAdapter object, specify its FileDataAdapterBase.FileUri property value as a KML file Uri, and assign the object to the VectorItemsLayer.Data property.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-load-data-from-a-kml-file-t140303
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WinForms_MapControl_KmlFileDataAdapter {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}