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": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "polygon, centerline, Voronoi",
"author": "Filip Todic",
"author_email": "todic.filip@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6c/70/4f011ff5302bfddfee9e5c4e2859db1564cc6344c98560bc9c1636b5321d/centerline-1.1.1.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.1",
"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": "ad42adf684c50e85b7f43c438e1aa61cfa5df98abe03a759916693347998f14d",
"md5": "82f0cece98a1e004a5c4ed9d01b4ae13",
"sha256": "61ea28efa1babd04b1ec97fecbc07eeb848196a48d2748a1cddb46080dd70489"
},
"downloads": -1,
"filename": "centerline-1.1.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "82f0cece98a1e004a5c4ed9d01b4ae13",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.7",
"size": 7921,
"upload_time": "2024-05-26T11:59:16",
"upload_time_iso_8601": "2024-05-26T11:59:16.443608Z",
"url": "https://files.pythonhosted.org/packages/ad/42/adf684c50e85b7f43c438e1aa61cfa5df98abe03a759916693347998f14d/centerline-1.1.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6c704f011ff5302bfddfee9e5c4e2859db1564cc6344c98560bc9c1636b5321d",
"md5": "4d9b1dbdceb989d42199aaa25912921b",
"sha256": "a7d804a2acbac32f837c3ba60ae3d433eb68d9f1f2cbb7d9614a99fabe500e2e"
},
"downloads": -1,
"filename": "centerline-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "4d9b1dbdceb989d42199aaa25912921b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 150395,
"upload_time": "2024-05-26T11:59:18",
"upload_time_iso_8601": "2024-05-26T11:59:18.451264Z",
"url": "https://files.pythonhosted.org/packages/6c/70/4f011ff5302bfddfee9e5c4e2859db1564cc6344c98560bc9c1636b5321d/centerline-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-26 11:59:18",
"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"
}