Skip to content

ECMWFCode4Earth/PolyShell

Repository files navigation

PolyShell

A high-performance coverage-preserving polygon reduction library for Python, written in Rust.

PyPI - Version Build Status Docs Build Status

Shows a bar chart with benchmark results.

Time to reduce a 50,000 point polygon by 90%.


Highlights

  • ✅ 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.


Installation

PolyShell is available on PyPI for easy installation:

$ pip install polyshell

PolyShell can also be built from source using maturin. See the guide here.


Example

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.


Learn more

For more information see the guide

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •