README 未说明是否需要额外安装 GEOS 等系统依赖;命令行需输入矢量文件格式,输出格式由扩展名决定
用 Voronoi 图从道路河流等长条多边形中提取中心线,方便计算长度
用 Python 计算多边形中心线的工具,基于 Voronoi 图把面状地物(如河流、道路)提取成线状结构,支持 shapefile 等空间数据,也可命令行调用。
核心能力
- 基于 Voronoi 图生成多边形中心线
- 提供 create_centerlines 命令行脚本转换矢量文件
- 提供 Centerline 类可嵌入自有工作流
- 支持附加自定义属性并随几何对象保留
容易踩的坑
- 1.0.1最新正式版2024-01-03 · 2024-01-03 19:36 UTC
这个版本没有写更新说明。
- 0.52018-09-09 · 2018-09-09 15:38 UTC
查看更新说明
Added
MultiPolygonsupport
- 0.4.22018-09-09 · 2018-09-09 15:28 UTC
查看更新说明
Added
GDAL2.3.1 to the CI configuration
Changed
- Moved the
coverageconfiguration tosetup.cfg - Moved the package's metadata to
setup.cfg
Fixed
Removed
- MANIFEST.in
Centerlinefrom thecenterlinenamespace. To import theCenterlineclass, usefrom centerline.main import Centerline
- 0.4.12018-01-07 · 2018-01-07 17:46 UTC
查看更新说明
Fixed
- Ignore the
osgeopackage when building the documentation on readthedocs.org
- Ignore the
- 0.42018-01-07 · 2018-01-07 17:45 UTC
查看更新说明
Added
- Sphinx documentation
Fixed
- Add a comma to the list of development requirements
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
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
Centerlineclass 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>