kml2geojson
A Python library to convert KML files to GeoJSON files
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a specific problem (KML-to-GeoJSON conversion with styling preservation) that GDAL is often overkill for. Suitable for web-focused geospatial workflows where lightweight dependencies matter.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Installs cleanly with a single runtime dependency (click).
- Actively maintained with a recent release (39 days ago) and support for current Python versions (3.11+).
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—suitable for most projects that include proper attribution.
last release 2026-07-06 (39 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 208,019 downloads/mo, #9,537 on PyPI
Alternatives
Verify before relying
pip install kml2geojson
from kml2geojson import convert
result = convert('input.kml')
# result is a dict with 'feature_collections' key
# Or from CLI: k2g input.kml output.geojson- Performance characteristics with large KML files (file size limits, conversion speed).
- Completeness of KML 2.2 spec coverage beyond the documented feature set.
- Behavior when KML contains unsupported or malformed geometry elements.
What it is and what it does
kml2geojson is a Python library that translates KML (Keyhole Markup Language) files into GeoJSON format. It's designed as a lightweight, dependency-minimal alternative to GDAL, with a codebase adapted from the Node.js togeojson package. The library handles standard KML elements like Placemarks, GroundOverlays, and NetworkLinks, and converts them to valid GeoJSON FeatureCollections.
Beyond basic conversion, it preserves KML styling information (colors, opacity, icons), can catalog all styles used in a document, optionally organizes output by KML folder structure, and supports typed ExtendedData via KML Schemas. It works both as a Python library and as a command-line tool (k2g), making it suitable for batch processing or integration into data pipelines. The package depends only on click for CLI support.
Use it for
- Convert geographic data from Google Earth KML exports to GeoJSON for web mapping libraries like Leaflet or Mapbox.
- Batch-process KML files from GPS devices or survey tools into a standardized format for GIS analysis.
- Preserve KML styling (colors, icons) when migrating map data to web-based visualization platforms.
- Extract and organize nested KML folder hierarchies into separate GeoJSON FeatureCollections for layered map rendering.
- Parse KML with custom ExtendedData attributes and convert them to GeoJSON properties for downstream processing.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a specific problem (KML-to-GeoJSON conversion with styling preservation) that GDAL is often overkill for. Suitable for web-focused geospatial workflows where lightweight dependencies matter.
Install
kml2geojson on PyPI
Before you install
Installs cleanly with a single runtime dependency (click). Actively maintained with a recent release (39 days ago) and support for current Python versions (3.11+).
Requires Python 3.11 or later.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for most projects that include proper attribution.
Quickstart
pip install kml2geojson
from kml2geojson import convert
result = convert('input.kml')
# result is a dict with 'feature_collections' key
# Or from CLI: k2g input.kml output.geojson
Verify before relying
- Performance characteristics with large KML files (file size limits, conversion speed).
- Completeness of KML 2.2 spec coverage beyond the documented feature set.
- Behavior when KML contains unsupported or malformed geometry elements.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageclick |
| Maintenance | Actively maintained 39 days since the last release |
| First released | |
| Downloads | 208,019 / month, #9,537 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: kml2geojson-6.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “kml to geojson conversion”
- kml2geojsonConverts KML files to GeoJSON format, preserving styling, folder…
- pyulogParses ULog files (a self-describing logging format) and provides…
- arcgis2geojsonConverts ArcGIS JSON format to GeoJSON format, supporting both string…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also osm2geojson · arcgis2geojson · fastkml · geojson · geomet · pyulog · simplekml · plpygis · cligj · pykml