skillfed

fastkml

Fast KML processing in python

fastkml v1.4.0 280.7K downloads/30d#8,108 on PyPI256
Copyleft license LGPL Active released

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 fastkml

uv

uv add fastkml

poetry

poetry add fastkml

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: GraalPyProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/Engineering :: GISTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Markup :: XMLTyping :: Typed

Tags

kml file parsing pythonread write kml filesgeospatial xml processingkml geometry handlingkml to python objects
geospatialkmlxml-parsing

More Libraries packages