KML Format in WPF Maps (SfMap)

18 Oct 20222 minutes to read

KML is a file format used for rendering geographical data. It uses a tag-based structure with nested elements and attributes. KML is based on the XML standard, and all tags of a KML file are case-sensitive.

Currently, the SfMaps control supports the following KML elements:

  • Place mark
  • Point
  • LinearRing
  • Polygon
  • MultiGeometry
  • Region
  • Style
  • StyleMap
  • BalloonStyle
  • LineStyle
  • PolyStyle
  • IconStyle
  • ExtendedData

KML Shapes Support in ShapeFileLayer

A KML file can be rendered with the help of the ShapeFileLayer in SfMap. The KML file should be added as an Embedded Resource to the application project. The URI of the KML file must be given in the following order:

  1. Namespace of project
  2. Folder names
  3. KmlFileName.kml

  4. XAML
  5. <syncfusion:SfMap>
                <syncfusion:SfMap.Layers>
                    <syncfusion:ShapeFileLayer Uri="KmlImportDemo.KMLFiles.Eu.kml">                    
                    </syncfusion:ShapeFileLayer>
                </syncfusion:SfMap.Layers>
            </syncfusion:SfMap>

KML Shapes Support in ShapeFileLayer

KML Shapes Support in SubShapeFileLayer

A KML file can be rendered with the help of the SubShapeFileLayer in SfMap.The URI of the KML file given in SubShapeFileLayer as follows.

  • XAML
  • <syncfusion:SfMap>
                <syncfusion:SfMap.Layers>
                    <syncfusion:ShapeFileLayer Uri="KmlImportDemo. ShapeFiles.world1.shp">
                        <syncfusion:ShapeFileLayer.SubShapeFileLayers>
                            <syncfusion:SubShapeFileLayer Uri="KmlImportDemo.KmlFiles.Eu.kml"/>
                        </syncfusion:ShapeFileLayer.SubShapeFileLayers>
                    </syncfusion:ShapeFileLayer>
                </syncfusion:SfMap.Layers>
            </syncfusion:SfMap>

    KML Shapes Support in SubShapeFileLayer

    NOTE

    You can refer to our WPF Map feature tour page for its groundbreaking feature representations. You can also explore our WPF Map example to know how to render and configure the map.