Registry / serialization / simplekml

simplekml

JSON →
library1.3.6pypypi✓ verified 85d ago

simplekml is a Python package designed for generating KML (Keyhole Markup Language) and KMZ files with minimal effort. It simplifies the creation of KML documents, folders, points, linestrings, and polygons without requiring in-depth knowledge of the KML standard itself. The current version is 1.3.6. Release cadence is infrequent, with the last update in 2021, and prior updates in 2020 and 2018.

pip install simplekml
INSTALL
IMPORT
SIG · SIMPLEKML
S
simplekml
serializationpythonv1.3.6
Install
2.5s avg
Import
121ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.127s · 19.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.5s · import 0.114s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Kml
from simplekml import Kml
simplekml
import simplekml

This example demonstrates how to create a basic KML file with a single point named 'Kirstenbosch' at specified coordinates and save it to a file.

import simplekml kml = simplekml.Kml() kml.newpoint(name="Kirstenbosch", coords=[(18.432314, -33.988862)]) # Longitude, Latitude, optional height kml.save("botanicalgarden.kml")
Debug
Known issues
gotchaCoordinates order: simplekml expects coordinates in (longitude, latitude, optional height) order. This is a common source of error as many other GIS contexts use (latitude, longitude).
fix
Always provide coordinates as `(longitude, latitude, ...)` tuples or lists, e.g., `coords=[(lon, lat)]`.
affects: All versions
gotchaPolygons with multiple inner boundaries may not render correctly in Google Maps for Android. While Google Earth is more forgiving, Google Maps for Android (especially with older SDK utility libraries) may require multiple `<innerBoundaryIs>` tags, each with a single `<LinearRing>`, rather than simplekml's output of multiple `LinearRing` elements within a single `<innerBoundaryIs>` tag.
fix
If targeting Google Maps for Android, thoroughly test KML output with complex polygons. For critical applications, manual post-processing of the KML or alternative rendering libraries might be necessary. This is an open issue with simplekml.
affects: All versions, particularly when targeting Google Maps for Android.
gotchaFor complex GPS track data (e.g., time-series points), KML is not the most suitable format, and simplekml does not directly support advanced KML extensions like `gx:Track`. Consider using the GPX format and a library like `gpxpy` for such use cases, as GPX is better designed for tracks.
fix
For basic tracks, use `simplekml.LineString`. For rich GPS track features including timestamps, use a dedicated GPX library (e.g., `gpxpy`) or convert data to GPX.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'simplekml'
The simplekml package is not installed in the Python environment where the script is being executed.
fix
pip install simplekml
AttributeError: 'Kml' object has no attribute 'add_point'
The simplekml library uses `newpoint()` to create a new point feature, not `add_point()`.
fix
Use `kml.newpoint(name='My Point', coords=(longitude, latitude))` instead of `kml.add_point`.
TypeError: 'float' object is not iterable
The `coords` argument for methods like `newpoint()` expects an iterable (e.g., a tuple or list of floats) but received a single float.
fix
Provide coordinates as an iterable, for example, `kml.newpoint(name='Location', coords=(longitude, latitude, altitude))`.
Upgrade
Version history
1.3.6latest on PyPI · released Sep 16, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources
simplekml — pip install simplekml · libregistry