simplify_polyline
Simplify an open or closed polyline.
Two functions:
Visvalingham-Whyatt removes the smallest triangles formed by three consecutive points in a polyline or polygon. The big advantage for my purposes is that the starting point on a polygon will not affect the result. The big disadvantage is that tall, thin spikes are removed along with short, thin triangles. So the smoothed polygon or polyline may not fit in anything close to the convex hull of the input.
use the Visvalingham-Whyatt algorithm with vs_simplify
Douglas-Peucker gives a better representation of the convex hull. The big
disadvantage with Douglas-Peucker is that the starting point on a polygon will affect
the result. I've addressed this in the slow, but ideal (for my purposes) simplify
function.
use the Douglas-Peucker algoritm with simplify
This will usually be the better choice.
arguments
verts vertices along polyline. Anything that can be cast into a '*, 2' array.
(simplify) min_dist minimum height above a line segment for a point to be
included.
(vw_simplify) min_area minimum area of a triangle for a point to be
included.
is_closed optionally specify whether verts describe a polyline or polygon. If not specified, is_closed is inferred from verts[0] == verts[-1]. The form of the input (last vert == first vert) will be replicated in the output.
If verts is (a, b, c, d, a), return value will be (a, ..., a)
If verts is (a, b, c, d), and is_closed is True, return value will be (a, ..., d)
So, there are two ways to deal with closed polygons:
-
close by repeating first point at the end. Return value will keep this format
-
close by specifying
is_closed. Return value will not repeat last point
install
pip install simplify_polyline
Metadata
Release files for simplify-polyline 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simplify_polyline-0.1.0.tar.gz | 11.0 kB | Without provenance | Details for simplify_polyline-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simplify_polyline-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for simplify_polyline-0.1.0-py3-none-any.whl |
Total release size: 19.5 kB
Release files / simplify_polyline-0.1.0.tar.gz
| Download URL | simplify_polyline-0.1.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcc1a359acb66d97ae5ddfbc04f15fd02784a3b69ee01c6f0a9f80b7f85ec621
|
|
BLAKE2b-256 checksum How to use checksums |
7b0617e11f62ce2b02443f6c3cf2011c5ebf69a627ec0749e8a29cfbfbafaecb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Release files / simplify_polyline-0.1.0-py3-none-any.whl
| Download URL | simplify_polyline-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
620dfbc82d9c7eb7a520d489c333c4b87472d17568746098dc7db2e025f15bf5
|
|
BLAKE2b-256 checksum How to use checksums |
4b1840d478a4a23861b021e32ad99c66742a2a27e6b2c5e1ec820422ba8613c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Security for simplify-polyline 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.