Map for WinForms | ComponentOne
KML / Import and Export
In This Topic
    Import and Export
    In This Topic

    KML import is performed by KmlReader class that has static methods, which creates collection of vector objects from the supplied KML source (string or stream). The collection can be easily added to the C1.Win.Map.VectorLayer class. The DataContext of the imported object is set to the corresponding XElement from the KML source so you can use the original element to perform custom operation during import.

    KML export is performed by KmlWriter class, which has static methods that write the collection of vector objects to the provided stream in KML format. The KmlWriter.Write() method has parameter saveElementCallback that allows you to perform custom operations during export. The method is called for each element that is saved in KML stream. For example, using the callback method you can add KML custom data to the elements.

    Note: There are few limitations in KML import and export.

    Import Limitations

    • Only KML Placemark elements are supported.
    • Inner polygons are not supported.
    • Icons are not supported.
    • External links are not supported.

    Export Limitations

    • C1VectorPlacemark.Geometry is not saved in KML stream.