The pyKML library is separated into several modules, based on similar functionality.
pyKML Factory Module
The pykml.factory module provides objects and functions that can be used to create KML documents element-by-element. The factory module leverages lxml’s ElementMaker factory objects to create KML objects with the appropriate namespace prefixes.
Returns the correct factory object for a given namespace
Generates a python script that will construct a given KML document
pyKML Parser Module
The pykml.parser module provides functions that can be used to parse KML from a file or remote URL.
A class representing an XML Schema used to validate KML documents
Asserts that a KML document is valide
The method generates a validation error if the document is not valid when compared to the XML Schema.
Validates a KML document
This method eturns a boolean value indicating whether the KML document is valid when compared to the XML Schema.
Parses a KML text string
This function parses a KML text string and optionally validates it against a provided schema object
Parses a file object
This functon parses a KML file object, and optionally validates it against a provided schema.
pyKML Helpers Module
The pykml.helpers module contains ‘helper’ functions that operate on pyKML document objects for accomplishing common tasks.
Separates the namespace from the element
Sets the maximum number of decimal places used by KML elements
This method facilitates reducing the file size of a KML document.