Skip to main content

A Python library to covert KML files to GeoJSON files

Project description

https://github.com/mrcagney/kml2geojson/actions/workflows/run_tests.yml/badge.svg

kml2geojson is a Python 3.8+ 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 create a style dictionary cataloging all the KML styles used

  • Optionally create several GeoJSON FeatureCollections, one for each KML folder present

Installation

Create a Python 3.8+ virtual environment and run poetry add kml2geojson.

Usage

Use as a library or from the command line. For instructions on the latter, type k2g --help.

Documentation

In the docs directory and published at mrcagney.github.io/kml2geojson_docs.

Notes

  • Development status is Alpha.

  • This project uses semantic versioning.

  • Thanks to MRCagney for funding this project.

Authors

  • Alex Raichev (2015-10-03), maintainer

Contributing

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

Changes

5.1.0, 2022-04-29

  • Extended convert() to accept a KML file object.

  • Added type hints.

  • Updated dependencies and removed version caps.

  • Dropped support for Python versions less than 3.8.

  • Switched from Travis CI to Github Actions.

5.0.1, 2021-10-11

  • Re-included the MIT License file and added more metadata to the file pyproject.toml for a more informative listing on PyPi.

5.0.0, 2021-10-07

  • Upgraded to Python 3.9 and dropped support for Python versions < 3.6.

  • Switched to Poetry.

  • Breaking change: refactored the convert function to return dictionaries instead of files.

  • Moved docs from Rawgit to Github Pages.

4.0.2, 2017-04-26

  • Fixed the bug where setup.py could not find the license file.

4.0.1, 2017-04-22

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

First

Project details


Download files

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

Source Distribution

kml2geojson-5.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

kml2geojson-5.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file kml2geojson-5.1.0.tar.gz.

File metadata

  • Download URL: kml2geojson-5.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.12 Linux/5.4.0-107-generic

File hashes

Hashes for kml2geojson-5.1.0.tar.gz
Algorithm Hash digest
SHA256 76a69f598e55d2eff90332e87ee9480c36120f60e6f5d6b5aaeba63ce92a3dfa
MD5 9f4494edd1794c728d00db6eb49ff58d
BLAKE2b-256 2feb45891463bdd2117cf468aa1cda382edd293799bb79ee2b6660709ad3f63f

See more details on using hashes here.

File details

Details for the file kml2geojson-5.1.0-py3-none-any.whl.

File metadata

  • Download URL: kml2geojson-5.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.12 Linux/5.4.0-107-generic

File hashes

Hashes for kml2geojson-5.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fc3096a6feb3728e97521db30f4c55982f3f7ad299892687a41b1b5528f55df
MD5 7acfd7195c11f9fe1e2c6c601faee286
BLAKE2b-256 8d711346b2f1530c7cb027d61b8e323919b77a19ace9e9aafcff978b1043c888

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page