Skip to content

ecmwf/PolyShell

Repository files navigation

PolyShell

Static Badge Static Badge PyPI - Version Build Status Docs Build Status

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

Important

This software is Emerging and subject to ECMWF's guidelines on Software Maturity.

Shows a bar chart with benchmark results.

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

This project was developed as part of ECMWF's Code4Earth initiative by Niall Oswald, Kenneth Martin and Jo Wayne Tan.


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

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5