An advanced forest line feature analysis platform
Reason this release was yanked:
Problem package
Project description
label_centerlines
This tool runs with Python 3.6 and reads Polygon/MultiPolygon datasets such as i.e. the geographic regions from Natural Earth and extracts smoothed centerlines for better label placement. This method is used to create the label layer of EOX Maps.
To do so, it a Voronoi diagram is created to get the polygon skeleton where the skeleton centerline is selected and smoothed.
Steps:
- Extract outline.
- Segmentize outline to get more evenly distributed outline points.
- Extract points.
- If there are too many points, simplify the segmentized outline and Extract points again.
- Create Voronoi diagram.
- Select all Voronoi edges which are inside the source polygon.
- Determine the best line.
- Smooth line.
Installation
Networkit is added to speedup the path finding.
Installation
clone repository and run
pip install -r requirements.txt
python setup.py install
or by conda .. code-block:: shell conda install -c appliedgrg label_centerline
CLI
$ label_centerlines --help
Usage: label_centerlines [OPTIONS] INPUT_PATH OUTPUT_PATH
Read features, convert to centerlines and write to output.
Multipart features (MultiPolygons) from input will be converted to
singlepart features, i.e. all output features written will be LineString
geometries, not MultiLineString geometries.
Options:
--version Show the version and exit.
--segmentize_maxlen FLOAT Maximum segment length for polygon borders.
(default: 0.5)
--max_points INTEGER Number of points per geometry allowed before
simplifying. (default: 3000)
--simplification FLOAT Simplification threshold. (default: 0.05)
--smooth INTEGER Smoothness of the output centerlines.
(default: 5)
--max_paths INTEGER Number of longest paths used to create the centerlines.
(default: 5)
--output_driver [GeoJSON|GPKG] Output format. (default: 'GeoJSON')
--verbose show information on processed features
--debug show debug log messages
--help Show this message and exit.
API
>>> from label_centerlines import get_centerline
>>> help(get_centerline)
get_centerline(geom, segmentize_maxlen=0.5, max_points=3000, simplification=0.05, smooth_sigma=5, max_paths=5)
Return centerline from geometry.
Parameters:
-----------
geom : shapely Polygon or MultiPolygon
segmentize_maxlen : Maximum segment length for polygon borders.
(default: 0.5)
max_points : Number of points per geometry allowed before simplifying.
(default: 3000)
simplification : Simplification threshold.
(default: 0.05)
smooth_sigma : Smoothness of the output centerlines.
(default: 5)
max_paths : Number of longest paths used to create the centerlines.
(default: 5)
Returns:
--------
geometry : LineString or MultiLineString
Raises:
-------
CenterlineError : if centerline cannot be extracted from Polygon
TypeError : if input geometry is not Polygon or MultiPolygon
License
MIT License
Copyright (c) 2015, 2016, 2017, 2018 EOX IT Services
(see LICENSE file for more details)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bera_centerlines-2025.3.0.tar.gz.
File metadata
- Download URL: bera_centerlines-2025.3.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e510bbd26e03a6c1be02367cb6255c06c2a2831e75ecca1545e96cd096dc4f
|
|
| MD5 |
063d8c732db84804017ea76692d1c96a
|
|
| BLAKE2b-256 |
bda79347c3b8ee25d6164d26eb2f34c1fec6f00938082c4ce1ed6258013499b3
|
File details
Details for the file bera_centerlines-2025.3.0-py3-none-any.whl.
File metadata
- Download URL: bera_centerlines-2025.3.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f3262c88d5358bd5c40cd3858737c5d367e172d96cc7d3d424811a121fca205
|
|
| MD5 |
3a747800fc9fd779e88ab3c5cf90cb4f
|
|
| BLAKE2b-256 |
de5d03e52fd245fd45be3575387bd927376a1299fdd00cd63d8164ea71ba3bf1
|