ComponentOne Maps for WPF and Silverlight
KmlReader Class
Members  Example 

C1.WPF.Maps Namespace : KmlReader Class
Contains methods for importing KML and KMZ files.
Object Model
KmlReader Class
Public MustInherit NotInheritable Class KmlReader 
public static class KmlReader 

KML is a popular XML-based language used for representing geographic information.

There are several tools available for creating, editing, and viewing KML files.

There are also several sources of free and commercial KML and KMZ files, including for example and

KMZ is also a popular format which consists of zipped KML, and is also supported by the KmlReader class.

The KmlReader class has static methods that create collections of vector objects from the supplied KML or KMZ source. These objects can then be added to a C1VectorLayer and placed on the map.
The code below prompts the user for a KML or KMZ file, then uses the KmlReader class to parse the information into elements which are then added to a layer and to the map.
// prompt the user to pick a KML or KMZ file
var dlg = new OpenFileDialog();
dlg.Filter = "KML/KMZ geodata files (*.kml;*.kmz)|*.kml;*.kmz";
if (dlg.ShowDialog().Value)
  // open the file for reading
  using (var stream = dlg.File.OpenRead())
    // create a new vector layer to hold the KML/KMZ items
    var kmlLayer = new C1VectorLayer();
    // read the items from the file and add them to the new layer
    var kmlItems = KmlReader.Read(stream);
    foreach (var item in kmlItems)
    // add the new layer to the map
Inheritance Hierarchy


See Also


KmlReader Members
C1.WPF.Maps Namespace