centerline


Namecenterline JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/fitodic/centerline
SummaryCalculate the centerline of a polygon
upload_time2024-02-10 20:26:09
maintainer
docs_urlNone
authorFilip Todic
requires_python>=3.7
licenseMIT License
keywords polygon centerline voronoi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Centerline
==========

.. image:: https://github.com/fitodic/centerline/actions/workflows/ci.yml/badge.svg?event=push
    :target: https://github.com/fitodic/centerline/actions
    :alt: Build status

.. image:: https://codecov.io/gh/fitodic/centerline/branch/master/graph/badge.svg?token=S2WQ9OTR9O
    :target: https://codecov.io/gh/fitodic/centerline
    :alt: Test coverage status

.. image:: https://readthedocs.org/projects/centerline/badge/?version=latest
    :target: http://centerline.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://img.shields.io/pypi/v/centerline.svg
    :target: https://pypi.python.org/pypi/centerline
    :alt: Version

.. image:: https://pepy.tech/badge/centerline
    :target: https://pepy.tech/project/centerline
    :alt: Downloads

.. figure::  docs/images/example.png
   :align:   center

Roads, rivers and similar linear structures are often represented by
long and complex polygons. Since one of the most important attributes of
a linear structure is its length, extracting that attribute from a
polygon can prove to be more or less difficult.

This library tries to solve this problem by creating the the polygon's
centerline using the `Voronoi diagram
<https://en.wikipedia.org/wiki/Voronoi_diagram>`_. For more info on how
to use this package, see the
`official documentation <http://centerline.readthedocs.io/>`_.


Features
^^^^^^^^

* A command-line script for creating centerlines from a vector source file and saving them into a destination vector file: ``create_centerlines``

.. code:: bash

    $ create_centerlines input.shp output.geojson


* The ``Centerline`` class that allows integration into your own workflow.


.. code:: python

    >>> from shapely.geometry import Polygon
    >>> from centerline.geometry import Centerline

    >>> polygon = Polygon([[0, 0], [0, 4], [4, 4], [4, 0]])
    >>> attributes = {"id": 1, "name": "polygon", "valid": True}

    >>> centerline = Centerline(polygon, **attributes)
    >>> centerline.id == 1
    True
    >>> centerline.name
    'polygon'
    >>> centerline.geometry.geoms
    <shapely.geometry.base.GeometrySequence object at 0x7f7d24116210>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fitodic/centerline",
    "name": "centerline",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "polygon,centerline,Voronoi",
    "author": "Filip Todic",
    "author_email": "todic.filip@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/f1/774fb1b2173bb743343897879b7e78e6486a38617885cd3ad5743d0ae19b/centerline-1.1.0.tar.gz",
    "platform": "POSIX",
    "description": "Centerline\n==========\n\n.. image:: https://github.com/fitodic/centerline/actions/workflows/ci.yml/badge.svg?event=push\n    :target: https://github.com/fitodic/centerline/actions\n    :alt: Build status\n\n.. image:: https://codecov.io/gh/fitodic/centerline/branch/master/graph/badge.svg?token=S2WQ9OTR9O\n    :target: https://codecov.io/gh/fitodic/centerline\n    :alt: Test coverage status\n\n.. image:: https://readthedocs.org/projects/centerline/badge/?version=latest\n    :target: http://centerline.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/v/centerline.svg\n    :target: https://pypi.python.org/pypi/centerline\n    :alt: Version\n\n.. image:: https://pepy.tech/badge/centerline\n    :target: https://pepy.tech/project/centerline\n    :alt: Downloads\n\n.. figure::  docs/images/example.png\n   :align:   center\n\nRoads, rivers and similar linear structures are often represented by\nlong and complex polygons. Since one of the most important attributes of\na linear structure is its length, extracting that attribute from a\npolygon can prove to be more or less difficult.\n\nThis library tries to solve this problem by creating the the polygon's\ncenterline using the `Voronoi diagram\n<https://en.wikipedia.org/wiki/Voronoi_diagram>`_. For more info on how\nto use this package, see the\n`official documentation <http://centerline.readthedocs.io/>`_.\n\n\nFeatures\n^^^^^^^^\n\n* A command-line script for creating centerlines from a vector source file and saving them into a destination vector file: ``create_centerlines``\n\n.. code:: bash\n\n    $ create_centerlines input.shp output.geojson\n\n\n* The ``Centerline`` class that allows integration into your own workflow.\n\n\n.. code:: python\n\n    >>> from shapely.geometry import Polygon\n    >>> from centerline.geometry import Centerline\n\n    >>> polygon = Polygon([[0, 0], [0, 4], [4, 4], [4, 0]])\n    >>> attributes = {\"id\": 1, \"name\": \"polygon\", \"valid\": True}\n\n    >>> centerline = Centerline(polygon, **attributes)\n    >>> centerline.id == 1\n    True\n    >>> centerline.name\n    'polygon'\n    >>> centerline.geometry.geoms\n    <shapely.geometry.base.GeometrySequence object at 0x7f7d24116210>\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Calculate the centerline of a polygon",
    "version": "1.1.0",
    "project_urls": {
        "Download": "https://pypi.org/project/centerline/",
        "Homepage": "https://github.com/fitodic/centerline"
    },
    "split_keywords": [
        "polygon",
        "centerline",
        "voronoi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "615528517f75f208d29dc42cc19c37089815de1eeef34804448e2ec3061cb872",
                "md5": "08f3455216e35980fee4e54050a3f8f6",
                "sha256": "b1fd57b499f8447d68c44621818b132f63151c4aca5b2b22431e06a2c8f683a2"
            },
            "downloads": -1,
            "filename": "centerline-1.1.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08f3455216e35980fee4e54050a3f8f6",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.7",
            "size": 7915,
            "upload_time": "2024-02-10T20:26:07",
            "upload_time_iso_8601": "2024-02-10T20:26:07.679138Z",
            "url": "https://files.pythonhosted.org/packages/61/55/28517f75f208d29dc42cc19c37089815de1eeef34804448e2ec3061cb872/centerline-1.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7af1774fb1b2173bb743343897879b7e78e6486a38617885cd3ad5743d0ae19b",
                "md5": "44e7406a968e1811dcd8e71e69c27d53",
                "sha256": "1348b3b55b5acea87b693503b353300a67ccc9c53e44e452259c0354a5a2f521"
            },
            "downloads": -1,
            "filename": "centerline-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "44e7406a968e1811dcd8e71e69c27d53",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 150349,
            "upload_time": "2024-02-10T20:26:09",
            "upload_time_iso_8601": "2024-02-10T20:26:09.955875Z",
            "url": "https://files.pythonhosted.org/packages/7a/f1/774fb1b2173bb743343897879b7e78e6486a38617885cd3ad5743d0ae19b/centerline-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-10 20:26:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fitodic",
    "github_project": "centerline",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "centerline"
}
        
Elapsed time: 0.19643s