Skip to main content

coarsen

Fast, multithreaded drop-ins for shapely.coverage_simplify and shapely.simplify, with byte-identical output to GEOS 3.13.1. Pure Rust ports of GEOS's CoverageSimplifier and TopologyPreservingSimplifier behind a thin Shapely wrapper. The Rust core links neither GEOS nor PROJ and performs no dynamic library loading.

pip install coarsen
import coarsen
import shapely

polygons = [shapely.box(0, 0, 10, 10), shapely.box(10, 0, 20, 10)]
result = coarsen.coverage_simplify(polygons, 5.0, threads=8)  # shapely.coverage_simplify
lines = coarsen.simplify(polygons, 2.0)  # shapely.simplify

simplify(geometry, tolerance, preserve_topology=True, *, threads=None, **kwargs) matches shapely.simplify: any geometry type, broadcasting, scalar in and scalar out, None passthrough, and the out and where ufunc keywords. The default topology-preserving mode runs in Rust. preserve_topology=False calls shapely.simplify, because GEOS repairs Douglas-Peucker polygons with buffer(0).

coverage_simplify(geometry, tolerance, *, simplify_boundary=True, threads=None) returns a NumPy object array with the input shape; scalar geometry input returns a scalar geometry, matching Shapely. simplify_boundary=False implements GEOS simplifyInner. threads=None uses Rayon's default pool; a positive integer creates a pool for that call. Rust parses, simplifies, and writes WKB without the GIL. Tolerance uses input coordinate units; project longitude/latitude data before using a tolerance in metres. Requires Python ≥3.10, NumPy, and Shapely ≥2.1.

The parity target is GEOS 3.13.1, bundled in Shapely 2.1.2's reference wheels. Tests compare WKB bytes without normalization at one and eight threads, including both boundary modes, the original 174 fixtures, real UTM parcels, Voronoi cells, grids, holes, MultiPolygons, empty input, zero tolerance, and Z/M coordinates. Z/M rebuilding follows GEOS's quirks. Other GEOS versions can produce different results. Parity is verified on these cases, not a proof for every floating-point input. Nonfinite XY coordinates are rejected. Invalid coverages are not repaired. The Rust library retains coverage validation; no Python invalid-edges helper is exposed because the port computes an invalid-polygon mask rather than edge geometry.

simplify is tested the same way: WKB bytes against Shapely 2.1.2 on 17,920 seeded random geometries of every type and 192 real parcels, at one and eight threads.

Coverage simplification, tolerance 5 m, median of three runs:

Tile Polygons Shapely (s) coarsen 1 thread (s) coarsen 8 threads (s) Speedup (8)
34UEU_0_0 42,858 92.03 22.74 9.65 9.5×
22JBM_0_0 33,919 94.71 21.94 8.24 11.5×
48RWV_0_0 183,423 92.90 17.80 6.42 14.5×

simplify (topology-preserving), single run on a shared login node:

Tile Polygons Tolerance Shapely (s) coarsen 1 thread (s) coarsen 8 threads (s)
34UEU_0_0 42,858 1.2 m 8.06 5.44 1.64
34UEU_0_0 42,858 5 m 7.50 3.33 1.45
22JBM_0_0 33,919 1.2 m 9.53 5.70 1.57
22JBM_0_0 33,919 5 m 9.68 4.10 1.22

Measured timings cover the complete public API, including WKB conversion, at 5 m in each tile's UTM CRS. See benchmark details.

LGPL-2.1-or-later. Derived from GEOS work by Martin Davis, Paul Ramsey, and other contributors; see NOTICE and LICENSE. Build, test, and release instructions are in CONTRIBUTING.md.

Metadata

Release files for coarsen 0.2.0

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

Source distribution (sdist)

Source distribution for coarsen 0.2.0
File Size Uploaded
coarsen-0.2.0.tar.gz 190.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for coarsen 0.2.0
File
coarsen-0.2.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
coarsen-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
coarsen-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
coarsen-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
coarsen-0.2.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
coarsen-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.2 MB

Release files / coarsen-0.2.0.tar.gz

Download URL coarsen-0.2.0.tar.gz
Size 190.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5ef0599de45771cd4fa5e73bb5fbd5dc80449e43f89bbe24c38a8d79b03a84ea
BLAKE2b-256 checksum
How to use checksums
29f88f4e08025b0f6302242f9d864c2a0148e013a743fdaa7caf5679a5f082f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / coarsen-0.2.0-cp310-abi3-win_amd64.whl

Download URL coarsen-0.2.0-cp310-abi3-win_amd64.whl
Size 337.8 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
80da61e8ec85d1ff6111acd27d675771fbc1329240e773065b61b0cf482d27f8
BLAKE2b-256 checksum
How to use checksums
0c3b3f92aa08471e4e866c6a3aa6e955d7b4e17dc42d864b18d3e490be318a5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / coarsen-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL coarsen-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 726.8 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
21e0ea1d1e86f79f1c5dd118075cd4376a63355bfee910eb6bef11be0455e2ee
BLAKE2b-256 checksum
How to use checksums
e131f1347a45a56a4fd3254b36056b51cb58468be05bbab30ee5a17396a3b0db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / coarsen-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL coarsen-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 519.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1b21c46688fe00503fa9a4da683ed6f94d26688b9458241c280290138722eee3
BLAKE2b-256 checksum
How to use checksums
08bff1b5bb9b57276a1cc85a8ac27c7636db5bafd3b5dda69bae208d17a15e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / coarsen-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL coarsen-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 508.5 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
bf7260bcd98fe64509c13f191543208086f3d294673401e1947991ffe2ba1579
BLAKE2b-256 checksum
How to use checksums
ac491175d2d03b7039075b0c3711600b8ee878cf58bd879facf0ffd5581187ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / coarsen-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL coarsen-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 458.5 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6a7a5e7a24a27bce03d75ea3a52d43f3ee7a068f0cde231071388480d4d7731d
BLAKE2b-256 checksum
How to use checksums
2b58ba6608561b809548c69773cf0d239897c5a3a5eed5b9f9ba22c6cb0df0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / coarsen-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL coarsen-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 467.1 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e1c79ee0a1a7c63804762444d58e84eb3f123c038ed4758538be9de627e8816d
BLAKE2b-256 checksum
How to use checksums
5dec8f193eb47e15c831c075ee3a25340137a2902450589041fe55ad0ed696e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

7 release files

This release

0.2.0 This release

7 release files

0.1.0

7 release files

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