C1.Silverlight.Maps Namespace : KmlReader Class |
'Declaration
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 www.geocommons.com and www.esri.com.
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.// 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) { kmlLayer.Children.Add(item); } // add the new layer to the map _c1map.Layers.Add(kmlLayer); } }
System.Object
C1.Silverlight.Maps.KmlReader
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2