| 1 |
FastKML |
| 2 |
======= |
| 3 |
|
| 4 |
A Python library for reading, writing and manipulating KML files. |
| 5 |
|
| 6 |
.. contents:: Table of Contents |
| 7 |
:local: |
| 8 |
:depth: 2 |
| 9 |
|
| 10 |
.. inclusion-marker-do-not-remove |
| 11 |
|
| 12 |
Introduction |
| 13 |
============ |
| 14 |
|
| 15 |
KML is an XML geospatial data format and an OGC_ standard that deserves a canonical |
| 16 |
python implementation. |
| 17 |
|
| 18 |
Fastkml is a library to read, write and manipulate KML files. It aims to keep |
| 19 |
it simple and fast (using lxml_ if available). Fast refers to the time you |
| 20 |
spend to write and read KML files as well as the time you spend to get |
| 21 |
acquainted to the library or to create KML objects. It aims to provide all of |
| 22 |
the functionality that KML clients such as `Marble <https://marble.kde.org/>`_, |
| 23 |
`NASA WorldWind <https://github.com/NASAWorldWind>`_, |
| 24 |
`Cesium JS <https://cesium.com/>`_, `OpenLayers <https://openlayers.org/>`_, |
| 25 |
`Google Maps <http://maps.google.com/>`_, and |
| 26 |
`Google Earth <http://earth.google.com/>`_ support. |
| 27 |
|
| 28 |
For more details about the KML Specification, check out the `KML Reference |
| 29 |
<https://developers.google.com/kml/documentation/kmlreference>`_ on the Google |
| 30 |
developers site. |
| 31 |
|
| 32 |
Features |
| 33 |
======== |
| 34 |
|
| 35 |
* **Simple and fast**: Easy-to-use API with fast performance |
| 36 |
* **Geometry support**: Handles geometries as pygeoif_ objects, compatible with any geometry that implements the ``__geo_interface__`` protocol, such as shapely_ |
| 37 |
* **Cross-platform compatibility**: Tested on `CPython <https://python.org>`_, `PyPy <https://www.pypy.org/>`_ and `GraalPy <https://www.graalvm.org/python/>`_ |
| 38 |
* **Python 3.9+**: Works on alternative Python implementations that support Python *>=3.9* |
| 39 |
|
| 40 |
Status |
| 41 |
====== |
| 42 |
|
| 43 |
**Quality Assurance:** |
| 44 |
|
| 45 |
|test| |hypothesis| |cov| |black| |mypy| |commit| |
| 46 |
|
| 47 |
**Package Information:** |
| 48 |
|
| 49 |
|pypi| |conda-forge| |status| |license| |pyversion| |pyimpl| |dependencies| |downloads| |
| 50 |
|
| 51 |
**Documentation & Community:** |
| 52 |
|
| 53 |
|doc| |stats| |
| 54 |
|
| 55 |
.. |test| image:: https://github.com/cleder/fastkml/actions/workflows/run-all-tests.yml/badge.svg?branch=main |
| 56 |
:target: https://github.com/cleder/fastkml/actions/workflows/run-all-tests.yml |
| 57 |
:alt: Test |
| 58 |
|
| 59 |
.. |hypothesis| image:: https://img.shields.io/badge/hypothesis-tested-brightgreen.svg |
| 60 |
:alt: Tested with Hypothesis |
| 61 |
:target: https://hypothesis.readthedocs.io |
| 62 |
|
| 63 |
.. |cov| image:: https://codecov.io/gh/cleder/fastkml/branch/main/graph/badge.svg?token=VIuhPHq0ow |
| 64 |
:target: http://codecov.io/github/cleder/fastkml?branch=main |
| 65 |
:alt: codecov.io |
| 66 |
|
| 67 |
.. |black| image:: https://img.shields.io/badge/code_style-black-000000.svg |
| 68 |
:target: https://github.com/psf/black |
| 69 |
:alt: Black |
| 70 |
|
| 71 |
.. |mypy| image:: https://img.shields.io/badge/type_checker-mypy-blue |
| 72 |
:target: http://mypy-lang.org/ |
| 73 |
:alt: Mypy |
| 74 |
|
| 75 |
.. |commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit |
| 76 |
:target: https://github.com/pre-commit/pre-commit |
| 77 |
:alt: pre-commit |
| 78 |
|
| 79 |
.. |pypi| image:: https://img.shields.io/pypi/v/fastkml.svg |
| 80 |
:target: https://pypi.python.org/pypi/fastkml |
| 81 |
:alt: Latest PyPI version |
| 82 |
|
| 83 |
.. |status| image:: https://img.shields.io/pypi/status/fastkml.svg |
| 84 |
:target: https://pypi.python.org/pypi/fastkml/ |
| 85 |
:alt: Development Status |
| 86 |
|
| 87 |
.. |license| image:: https://img.shields.io/pypi/l/fastkml |
| 88 |
:target: https://www.gnu.org/licenses/lgpl-3.0.en.html |
| 89 |
:alt: LGPL - License |
| 90 |
|
| 91 |
.. |doc| image:: https://readthedocs.org/projects/fastkml/badge/ |
| 92 |
:target: https://fastkml.readthedocs.org/ |
| 93 |
:alt: Documentation |
| 94 |
|
| 95 |
.. |stats| image:: https://www.openhub.net/p/fastkml/widgets/project_thin_badge.gif |
| 96 |
:target: https://www.openhub.net/p/fastkml |
| 97 |
:alt: Statistics from OpenHub |
| 98 |
|
| 99 |
.. |pyversion| image:: https://img.shields.io/pypi/pyversions/fastkml.svg |
| 100 |
:target: https://pypi.python.org/pypi/fastkml/ |
| 101 |
:alt: Supported Python versions |
| 102 |
|
| 103 |
.. |pyimpl| image:: https://img.shields.io/pypi/implementation/fastkml.svg |
| 104 |
:target: https://pypi.python.org/pypi/fastkml/ |
| 105 |
:alt: Supported Python implementations |
| 106 |
|
| 107 |
.. |dependencies| image:: https://img.shields.io/librariesio/release/pypi/fastkml |
| 108 |
:target: https://libraries.io/pypi/fastkml |
| 109 |
:alt: Libraries.io dependency status for latest release |
| 110 |
|
| 111 |
.. |downloads| image:: https://static.pepy.tech/badge/fastkml/month |
| 112 |
:target: https://pepy.tech/project/fastkml |
| 113 |
:alt: Downloads |
| 114 |
|
| 115 |
.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/fastkml.svg |
| 116 |
:target: https://anaconda.org/conda-forge/fastkml |
| 117 |
:alt: Conda-Forge |
| 118 |
|
| 119 |
Installation |
| 120 |
============ |
| 121 |
|
| 122 |
Basic Installation |
| 123 |
------------------ |
| 124 |
|
| 125 |
Install the package using pip: |
| 126 |
|
| 127 |
.. code-block:: bash |
| 128 |
|
| 129 |
pip install fastkml |
| 130 |
|
| 131 |
This will install FastKML with all required dependencies. |
| 132 |
|
| 133 |
With Optional Dependencies |
| 134 |
-------------------------- |
| 135 |
|
| 136 |
For enhanced performance, install with lxml: |
| 137 |
|
| 138 |
.. code-block:: bash |
| 139 |
|
| 140 |
pip install "fastkml[lxml]" |
| 141 |
|
| 142 |
Using Conda |
| 143 |
----------- |
| 144 |
|
| 145 |
You can also install FastKML using conda-forge: |
| 146 |
|
| 147 |
.. code-block:: bash |
| 148 |
|
| 149 |
conda install -c conda-forge fastkml |
| 150 |
|
| 151 |
Requirements |
| 152 |
============ |
| 153 |
|
| 154 |
Required Dependencies |
| 155 |
--------------------- |
| 156 |
|
| 157 |
* pygeoif_ - For geometry handling |
| 158 |
* arrow_ - For date and time processing |
| 159 |
|
| 160 |
Optional Dependencies |
| 161 |
--------------------- |
| 162 |
|
| 163 |
* lxml_ - For improved XML parsing performance (recommended) |
| 164 |
|
| 165 |
Documentation |
| 166 |
============= |
| 167 |
|
| 168 |
You can find all of the documentation for FastKML at `fastkml.readthedocs.org <https://fastkml.readthedocs.org>`_. If you find something that is missing, please submit a pull request on `GitHub <https://github.com/cleder/fastkml>`_ with the improvement. |
| 169 |
|
| 170 |
Limitations |
| 171 |
=========== |
| 172 |
|
| 173 |
Currently, the only major feature missing for the full Google Earth experience |
| 174 |
is the `gx extension |
| 175 |
<https://developers.google.com/kml/documentation/kmlreference#kmlextensions>`_. |
| 176 |
|
| 177 |
Please submit a PR with the features you'd like to see implemented. |
| 178 |
|
| 179 |
Contributing |
| 180 |
============ |
| 181 |
|
| 182 |
We welcome contributions! Please check out our `contributing guide <docs/contributing.rst>`_ for guidelines on how to contribute. |
| 183 |
|
| 184 |
.. _pygeoif: https://pypi.python.org/pypi/pygeoif/ |
| 185 |
.. _lxml: https://pypi.python.org/pypi/lxml |
| 186 |
.. _arrow: https://pypi.python.org/pypi/arrow |
| 187 |
.. _OGC: https://www.ogc.org/standard/kml/ |
| 188 |
.. _shapely: https://shapely.readthedocs.io/ |