fastkml
Fast KML processing in python
What it is and what it does
FastKML is a Python library for reading, writing, and manipulating KML files—an XML-based geospatial format standardized by the OGC. It wraps KML structures into Python objects, handling geometries through pygeoif (compatible with shapely and other __geo_interface__ implementations) and dates through arrow. The library aims for simplicity and speed, with optional lxml support for faster XML parsing.
Typical use cases include converting between KML and Python data structures, extracting geographic features from KML files, and building KML output programmatically. It supports modern Python versions (3.9+) across CPython, PyPy, and GraalPy, and is compatible with geospatial clients like Google Earth, Google Maps, OpenLayers, and Cesium JS.
Use it for:
- Parse KML files from mapping applications (Google Earth, Marble, NASA WorldWind) into Python geometry objects for analysis.
- Generate KML output from geographic data to visualize in web maps or desktop GIS clients.
- Convert between KML and other geospatial formats by leveraging pygeoif's geometry abstraction.
- Extract and manipulate geographic features (points, lines, polygons) embedded in KML documents.
- Build geospatial data pipelines that consume or produce KML as an interchange format.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reads, writes, and manipulates KML files—an XML-based geospatial data format—using a simple Python API with support for geometry objects and date/time handling.
Yes. FastKML is actively maintained, has no known vulnerabilities, installs with low friction, and solves a clear problem: KML file handling in Python. The LGPL license requires derivative works to remain open-source, which is a constraint for proprietary projects but not a blocker for most uses. Suitable for anyone working with KML data in geospatial workflows.
Install
fastkml on PyPI
pip
pip install fastkmluv
uv add fastkmlpoetry
poetry add fastkmlInstalling fastkml
Before you install
Low friction install with three core runtime dependencies (arrow, pygeoif, typing-extensions). Actively maintained as of 2025-11-04 with recent commits; no known vulnerabilities.
License in practice
Licensed under LGPL (copyleft); derivative works and modifications must remain open-source under compatible terms, which may constrain proprietary use.
Quickstart
pip install fastkml
from fastkml import kml
k = kml.KML()
# Read, write, or manipulate KML objects
Requires Python 3.9 or later; optional lxml dependency improves XML parsing performance.
Verify before relying
- Whether the library fully implements all KML 2.2 specification features beyond the documented gx extension limitation.
- Performance characteristics when handling large KML files or complex geometries.
Package facts
| License | LGPL (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — arrow, pygeoif, typing-extensions |
| Maintenance | actively maintained — 283 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 280,702/month — #8,108 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fastkml-1.4.0-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pykmlpyKML parses and creates KML documents using a…
permissive · top 15,000 on PyPI
kml2geojsonConverts KML files to GeoJSON format,…
permissive · top 15,000 on PyPI
simplekmlSimplekml generates KML (Keyhole Markup…
copyleft · top 15,000 on PyPI
pygeoifPyGeoIf provides lightweight, pure-Python…
copyleft · top 15,000 on PyPI
osm2geojsonConverts OpenStreetMap and Overpass API data…
permissive · top 15,000 on PyPI
python-libsbmlProvides Python bindings to read, write, and…
copyleft · top 15,000 on PyPI
shapelyShapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyshpPyShp reads and writes ESRI Shapefiles in pure…
permissive · top 5,000 on PyPI
docxCreates, reads, and writes Microsoft Office…
unclear · top 15,000 on PyPI
python-cmrProvides a Python wrapper around NASA's Common…
permissive · top 15,000 on PyPI