A good resource for how to use KML in general is the
from Google; this library has been designed to follow the names of KML elements as closely as possible.
For a quick example of how the library works, see the
page or the
Extracting information from a Kml file
For working with legacy files (for example, files created with an earlier version Google Earth), please see the
page. Or for using some of the features offered in Google Earth, take a look at
Google Earth compatibility
For a simple example of working with the elements inside a KML file, including extracting a specific type, see the
For more examples, please see the Examples folder in the source code downloads, which includes:
||Displays an information balloon text for all the Features in a KML file.
||Shows how KML can be updated by an Update element, and how to use the
Process extension method to apply the update in code.
||Shows how to copy Elements (an
Element can only have one parent and throws an exception if you try to add it to another
||Creates a simple IconStyle, based on the example given at the
||A simple example of creating a KML file from code.
||A simple example of how to create a KMZ file, which is a compressed archive containing a KML file and related resources for that file.
||Uses the StyleResolver.InlineStyles static method to create a new
Element that has the styles inside the
Feature, instead of using shared styles and specifying a
||Shows how to use the Parser class to parse a KML file, ignoring any namespaces declared in the XML.
||Iterates over all the styles in a KML file and displays their names in alphabetical order.
||Iterates over the placemarks in a file and displays their names in alphabetical order.
||Moves styles from a Feature to the enclosing Document and then sets the Feature.StyleUrl to reference the new style.