Welcome to FastKML’s documentation!¶
Introduction¶
KML is an XML geospatial data format and an OGC standard that deserves a canonical python implementation.
Fastkml is a library to read, write and manipulate KML files. It aims to keep it simple and fast (using lxml if available). Fast refers to the time you spend to write and read KML files as well as the time you spend to get acquainted to the library or to create KML objects. It aims to provide all of the functionality that KML clients such as Marble, NASA WorldWind, Cesium JS, OpenLayers, Google Maps, and Google Earth support.
For more details about the KML Specification, check out the KML Reference on the Google developers site.
Features¶
Simple and fast: Easy-to-use API with fast performance
Geometry support: Handles geometries as pygeoif objects, compatible with any geometry that implements the
__geo_interface__protocol, such as shapelyCross-platform compatibility: Tested on CPython, PyPy and GraalPy
Python 3.10+: Works on alternative Python implementations that support Python >=3.10
Status¶
Quality Assurance:
Package Information:
Documentation & Community:
Installation¶
Basic Installation¶
Add FastKML to your project by installing it from PyPI. You can install it using uv, pip, or conda.
uv add fastkml
This will install FastKML with all required dependencies.
With Optional Dependencies¶
For enhanced performance, install with lxml:
uv add "fastkml[lxml]"
Using pip¶
pip install fastkml
Using Conda¶
You can also install FastKML using conda-forge:
conda install -c conda-forge fastkml
Requirements¶
Required Dependencies¶
Optional Dependencies¶
lxml - For improved XML parsing performance (recommended)
Documentation¶
You can find all of the documentation for FastKML at fastkml.readthedocs.org. If you find something that is missing, please submit a pull request on GitHub with the improvement.
Limitations¶
FastKML does not model every element of the KML specification – for example
xal:AddressDetails and the <kml> root’s arbitrary hint attribute
are not currently supported.
Please submit a PR with the features you’d like to see implemented.
Contributing¶
We welcome contributions! Please check out our contributing guide for guidelines on how to contribute.
Rationale¶
Why yet another KML library? None of the existing ones quite fit my requirements, namely:
fastkml can read and write KML files, feeding fastkml’s output back into fastkml and serializing it again will result in the same output.
You can parse any KML snippet, it does not need to be a complete KML document.
It is fully tested and actively maintained.
Geometries are handled in the
__geo_interface__standard.Minimal dependencies, pure Python.
If available,
lxmlwill be used to increase its speed.
Key Features¶
Full KML object tree with
KML,Document,Folder,Placemark, overlays, views, and styles.Geometry adapters for
Point,LineString,Polygon,MultiGeometry,gx:Track, andgx:MultiTrack.Typed extended data with
Schema,SchemaData,Data, andgx:SimpleArrayData.Namespace-aware parsing and serialization backed by a central registry.
XML schema validation helpers and recursive search helpers like
find()andfind_all().Support for Google extension elements through
fastkml.gx.
User Guide
Concepts & Architecture
Reference & Project Info
- Reference Guide
- fastkml.kml
- fastkml.base
- fastkml.registry
- fastkml.kml_base
- fastkml.helpers
- fastkml.about
- fastkml.atom
- fastkml.config
- fastkml.containers
- fastkml.data
- fastkml.enums
- fastkml.exceptions
- fastkml.features
- fastkml.geometry
- fastkml.gx.data
- fastkml.gx.track
- fastkml.links
- fastkml.mixins
- fastkml.model
- fastkml.overlays
- fastkml.styles
- fastkml.times
- fastkml.types
- fastkml.utils
- fastkml.validator
- fastkml.views
- Contributing
- KML Resources and Tutorials
- Alternative KML libraries
- Changelog
- 1.5.0 (unreleased)
- 1.4.0 (2025/11/04)
- 1.3.0 (2025/10/16)
- 1.2.0 (2025/10/01)
- 1.1.0 (2024/12/02)
- 1.0 (2024/11/19)
- 0.12 (2020/09/23)
- 0.11.1 (2015/07/13)
- 0.11 (2015/07/10)
- 0.10 (2015/06/09)
- 0.9 (2014/10/17)
- 0.8 (2014/09/18)
- 0.7 (2014/08/01)
- 0.6 (2014/05/29)
- 0.5 (2013/10/23)
- 0.4 (2013/09/05)
- 0.3 (2012/11/15)
- 0.2 (2012/07/27)
- 0.1.1 (2012/06/29)
- 0.1 (2012/06/27)
