Skip to main content

rdp-limited-edition

PyPI - Version PyPI - Python Version


Table of Contents

About

Yet another Ramer-Douglas-Peucker algorithm implementation (line simplification). But this one is special! It allows to additionally define the maximum number of points to retain. This means the algorithm stops to select additional points as soon as the maximum number ot points is reached although there would be more points outside of the tolerance band. To that, a negative tolerance allows to always get a defined number of points which are chosen accoring to the RDP algorithm. To provide this feature, no recursion is used.

Pure numpy. Hence the performance is not as fast as C/Rust implementations like simplify or similar (approx. TODO times slower).

Installation

pip install rdp-limited-edition

Usage

import numpy as np
from rdp_limited_edition import rdp_limed

x = np.arange(360.0) * np.pi / 180.0
y = np.sin(x)

# let the tolerance be decisive
print(rdp_limed(x, y, max_points=x.shape[0], tolerance=0.005))

# get defined number of points
print(rdp_limed(x, y, max_points=10, tolerance=-1))

# or use both
print(rdp_limed(x, y, max_points=10, tolerance=0.1))
print(rdp_limed(x, y, max_points=10, tolerance=0.001))
  • D. H. Douglas and T. K. Peucker, “Algorithms for the reduction of the number of points required to represent a digitised line or its caricature,” The Canadian Cartographer, vol. 10, no. 2, pp. 112–122, Dec. 1973.

License

rdp-limited-edition is distributed under the terms of the MIT license.

Metadata

Release files for rdp-limited-edition 0.3.1

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

Built distribution (wheel)

Table of built distributions (wheels) for rdp-limited-edition 0.3.1
File Interpreter ABI Platform
rdp_limited_edition-0.3.1-py3-none-any.whl Python 3 none any Details

Release files / rdp_limited_edition-0.3.1-py3-none-any.whl

Download URL rdp_limited_edition-0.3.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1345f37b1a6077117c13446ced2aeccedaa94e83bd236440224a11bb624d167d
BLAKE2b-256 checksum
How to use checksums
c8e044d9e2dbcb38520f70219238a1ad64705e1111ff3db04b6a0943fbbaef8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

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