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 simplekmlVerified import paths — ran on the pinned version, not inferred.
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.
Always provide coordinates as `(longitude, latitude, ...)` tuples or lists, e.g., `coords=[(lon, lat)]`.
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.
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.
pip install simplekml
Use `kml.newpoint(name='My Point', coords=(longitude, latitude))` instead of `kml.add_point`.
Provide coordinates as an iterable, for example, `kml.newpoint(name='Location', coords=(longitude, latitude, altitude))`.
No dependency data recorded yet.