A high-performance coverage-preserving polygon reduction library for Python, written in Rust.
Time to reduce a 50,000 point polygon by 90%.
- ✅ Guarantees encapsulation of the initial polygon.
- 🔥 Rust-powered performance.
- 🧩 A simple Python API to access all reduction methods and modes.
- 🌍 Seamlessly integration with NumPy and Shapely.
- 📏 Tunable accuracy and reduction rates.
- 🐍 Python and PyPy compatible.
PolyShell is supported by the ECMWF through the Code for Earth programme.
PolyShell is available on PyPI for easy installation:
$ pip install polyshell
PolyShell can also be built from source using maturin. See the guide here.
All of PolyShell's reduction algorithms are accessible through reduce_polygon
.
from polyshell import reduce_polygon
original = [
(0.0, 0.0),
(0.0, 1.0),
(0.5, 0.5),
(1.0, 1.0),
(1.0, 0.0),
(0.0, 0.0),
]
reduced = reduce_polygon(original, "auto", method="vw")
For all the available options, see the full list of features.
For more information see the guide