Skip to main content

Centerline

Build status Test coverage status Documentation Status Version Downloads
docs/images/example.png

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. For more info on how to use this package, see the official documentation.

Features

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

$ create_centerlines input.shp output.geojson
  • The Centerline class that allows integration into your own workflow.

>>> 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>

Metadata

Release files for centerline 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for centerline 1.1.1
File Size Uploaded
centerline-1.1.1.tar.gz 150.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for centerline 1.1.1
File Interpreter ABI Platform
centerline-1.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 158.3 kB

Release files / centerline-1.1.1.tar.gz

Download URL centerline-1.1.1.tar.gz
Size 150.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a7d804a2acbac32f837c3ba60ae3d433eb68d9f1f2cbb7d9614a99fabe500e2e
BLAKE2b-256 checksum
How to use checksums
6c704f011ff5302bfddfee9e5c4e2859db1564cc6344c98560bc9c1636b5321d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / centerline-1.1.1-py2.py3-none-any.whl

Download URL centerline-1.1.1-py2.py3-none-any.whl
Size 7.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
61ea28efa1babd04b1ec97fecbc07eeb848196a48d2748a1cddb46080dd70489
BLAKE2b-256 checksum
How to use checksums
ad42adf684c50e85b7f43c438e1aa61cfa5df98abe03a759916693347998f14d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3

2 release files

0.2.1

2 release files

0.2

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page