Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A Python 3.4 package to convert KML files to GeoJSON files

Project Description
.. image::

kml2geojson is a Python 3.4+ package to convert KML files to GeoJSON files.
Most of its code is a translation into Python of the Node.js package `togeojson <>`_, but kml2geojson also adds the following features.

- Preserve KML object styling, such as color and opacity
- Optionally write one JSON file cataloging all the KML styles used
- Optionally create several GeoJSON files of FeatureCollections, one for each KML folder

``pip install kml2geojson``

At the command line type ``k2g --help`` for instructions.
You can also use kml2geojson as a library.

In ``docs`` and on RawGit `here <>`_.

- Development status: Alpha
- This project uses semantic versioning (major.minor.micro), where each breaking feature or API change is considered a major change

- Alex Raichev (2015-10-03)

If you want to help develop this project, here is some background reading.

- The `KML reference <>`_
- Python's `Minimal DOM implementation <>`_, which this project uses to parse KML files


4.0.2, 2017-04-26
- Fixed the bug where ```` could not find the license file.

4.0.1, 2017-04-22
- Stopped making FeatureCollections with top-level 'properties' attributes, because `RFC 7946 says that's not allowed <>`_. Moved FeatureCollection names into a top-level 'name' attribute.
- Stripped leading and trailing whitespace from text content to avoid cluttered or blank name and description attribute values
- Switched to pytest for testing

4.0.0, 2016-11-24
- Moved command line functionality to separate module
- Renamed some functions

3.0.4, 2015-10-15
Disambiguated filenames in ``main()``.

3.0.3, 2015-10-13
Improved ``to_filename()`` again.

3.0.2, 2015-10-12
Improved ``to_filename()`` and removed the lowercasing.

3.0.1, 2015-10-12
Tweaked ``to_filename()`` to lowercase and underscore results.
Forgot to do that last time.

3.0.0, 2015-10-12
Changed the output of ``build_layers()`` and moved layer names into the GeoJSON FeatureCollections

2.0.2, 2015-10-12
- Replaced underscores with dashes in command line options

2.0.1, 2015-10-12
- Set default border style for colored polygons

2.0.0, 2015-10-08
- Added documentation
- Tweaked the command line tool options

1.0.0, 2015-10-05
- Changed some names
- Added lots of tests

0.1.1, 2015-10-03
Fixed packaging to find ``README.rst``

0.1.0, 2015-10-03

Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
kml2geojson-4.0.2.tar.gz (10.4 kB) Copy SHA256 Checksum SHA256 Source Apr 25, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting