Registry / data / simplification

simplification

JSON →
library1.0.0pypypi✓ verified 85d ago

The `simplification` library provides highly optimized linestring (polyline) simplification using either the Ramer-Douglas-Peucker (RDP) or Visvalingam-Whyatt algorithms. It achieves high performance by leveraging a Rust binary through Python's Foreign Function Interface (FFI). The library is currently at version 0.7.14 and appears to be actively maintained with frequent minor releases.

pip install simplification
INSTALL
IMPORT
SIG · SIMPLIFICATION
S
simplification
datapythonv1.0.0
Install
3.7s avg
Import
335ms
Disk
89MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.7s · import 0.335s · 88MB
89MB installed
● package 89MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

simplify_coords
from simplification.cutil import simplify_coords
Primary function for Ramer-Douglas-Peucker simplification.
simplify_coords_vw
from simplification.cutil import simplify_coords_vw
Primary function for Visvalingam-Whyatt simplification.
simplify_coords_vwp
from simplification.cutil import simplify_coords_vwp
Topology-preserving variant of Visvalingam-Whyatt, which is slower but more likely to produce valid geometries.

This quickstart demonstrates how to simplify a linestring using both the Ramer-Douglas-Peucker (RDP) and Visvalingam-Whyatt (VW) algorithms. It showcases usage with both standard Python lists of coordinates and NumPy arrays, which are efficiently handled by the underlying Rust implementation. For RDP, `epsilon` defines the tolerance, while for VW, `threshold` represents a minimum effective area.

import numpy as np from simplification.cutil import simplify_coords, simplify_coords_vw # Example coordinates (list of lists or NumPy array) coords_list = [ [0.0, 0.0], [5.0, 4.0], [11.0, 5.5], [17.3, 3.2], [27.8, 0.1] ] coords_np = np.array(coords_list) # --- Ramer-Douglas-Peucker (RDP) Simplification --- # Epsilon: maximum distance between an original point and the simplified line segment epsilon_rdp = 1.0 simplified_rdp = simplify_coords(coords_list, epsilon_rdp) print(f"RDP Simplified (epsilon={epsilon_rdp}): {simplified_rdp}") # --- Visvalingam-Whyatt (VW) Simplification --- # Threshold: minimum effective area of a triangle formed by a point and its neighbors threshold_vw = 30.0 simplified_vw = simplify_coords_vw(coords_np, threshold_vw) print(f"VW Simplified (threshold={threshold_vw}): {simplified_vw}")
Debug
Known issues
gotchaThe library primarily exposes functions through `simplification.cutil`, which is a Cython/Rust FFI module. Direct imports from `simplification` (e.g., `from simplification import simplify`) will fail as the main simplification functions are not exposed at the top-level package.
fix
Always import specific simplification functions from `simplification.cutil`, e.g., `from simplification.cutil import simplify_coords`.
affects: All versions
gotchaThe library's documentation explicitly states that 'Error-checking is non-existent at this point.' This means invalid inputs (e.g., non-numeric coordinates, malformed lists) might lead to crashes or unexpected behavior rather than clear Python exceptions.
fix
Thoroughly validate input data (coordinate types and structure) before passing it to simplification functions to prevent runtime errors.
affects: All versions (v0.7.14 and earlier)
gotchaWhen using Visvalingam-Whyatt, the `simplify_coords_vwp` function offers a topology-preserving variant. While it produces geometries less prone to self-intersections, it is generally slower than `simplify_coords_vw`. Choose based on your application's need for speed versus geometric validity.
fix
Understand the trade-offs: use `simplify_coords_vw` for maximum speed if topological correctness is secondary; use `simplify_coords_vwp` when preserving topology is critical, accepting a performance cost.
affects: All versions
gotchaThe `simplification` library relies on a compiled Rust binary. While `pip install` typically handles pre-built wheels, local development or unusual environments might require a Rust toolchain for compilation, which can be a dependency hurdle.
fix
For local development from source, ensure Rust (cargo) is installed. If encountering installation issues in constrained environments, verify that pre-built wheels are available for your platform and Python version, or prepare to compile from source.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'simplification.cutil'
The `simplification` library's core functions are implemented in Rust and exposed via a `cutil` module. This error usually means the C/Rust extension module failed to compile or was not properly installed.
fix
Ensure `pip install simplification` completes without errors. If installing in a non-standard environment or from source, you may need a Rust toolchain installed (e.g., `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`) and potentially development headers for Python.
AttributeError: module 'simplification' has no attribute 'simplify_coords'
Attempting to import simplification functions directly from the top-level `simplification` package instead of its `cutil` submodule.
fix
Correct the import statement to specifically target `simplification.cutil`: `from simplification.cutil import simplify_coords` (or other relevant functions).
ValueError: input is not a valid sequence of coordinates
The input `coords` argument to `simplify_coords` or `simplify_coords_vw` is not in the expected format (e.g., not a list of lists/tuples of numbers, or a 2D NumPy array).
fix
Ensure your input coordinates are a sequence of sequences (e.g., `[[x1, y1], [x2, y2]]`) or a 2D NumPy array with shape `(N, 2)` or `(N, 3)` where N is the number of points and 2/3 are the dimensions.
Upgrade
Version history
1.0.0latest on PyPI · released Jun 8, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer.
numpyoptionalHighly recommended for efficient input/output of coordinate arrays.
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
simplification — pip install simplification · libregistry