Skip to main content

Banner

Polars ST

Polars ST provides spatial operations on Polars DataFrames, Series, and Expressions. Just like Shapely and GeoPandas, it make use of the GEOS library, meaning that its API is mostly identical to theirs.

>>> import polars_st as st
>>> gdf = st.GeoDataFrame({
...     "category": ["A", "A", "B"],
...     "geometry": [
...         "POLYGON((0 0, 0 4, 4 2, 0 0))",
...         "POLYGON((4 0, 4 4, 0 2, 4 0))",
...         "POLYGON((0 0, 2 2, 2 0, 0 0))",
...     ],
... })
>>> gdf = gdf.group_by("category").agg(st.intersection_all()).with_columns(area=st.area())
>>> gdf.with_columns(st.to_wkt())
shape: (2, 3)
┌──────────┬─────────────────────────────────────┬──────┐
│ category ┆ geometry                            ┆ area │
│ ---      ┆ ---                                 ┆ ---  │
│ str      ┆ str                                 ┆ f64  │
╞══════════╪═════════════════════════════════════╪══════╡
│ B        ┆ POLYGON ((0 0, 2 2, 2 0, 0 0))      ┆ 2.0  │
│ A        ┆ POLYGON ((4 2, 2 1, 0 2, 2 3, 4 2)) ┆ 4.0  │
└──────────┴─────────────────────────────────────┴──────┘

Installation

Polars ST is published on PyPI so you can install it with your preferred package manager.

pip install polars-st

How it works

Geometries are stored as EWKB in regular Polars Binary columns. EWKB is a extension to the WKB standard popularized by PostGIS, that also stores information about the CRS of each geometry as an integer code called SRID.

For every spatial operations, the WKB will be parsed into a Geometry object so the operation can be done. If the operation result is a geometry, it will then be serialized back to WKB. Because of that round-trip, some operations might turn out to be slower than GeoPandas. In most cases however, the performance penalty will be marginal and you will fully benefit from the parallelization capabilities of Polars.

About GeoPolars

GeoPolars is an very promising tool for manipulating geographic data in Polars based on the GeoArrow specification. It however seems to be quite a long way from being ready and feature-complete, mostly due to Polars lack of support for Arrow Extension Types and subclassing of core datatypes.

polars-st stores geometry as EWKB in regular Binary columns and delegates core functionality to GEOS, which allows it to be ready now, with full support for Z / M coordinates, curved geometry types (CircularString, CurvePolygon, ...) and Series with mixed geometry type and SRIDs.

About Polars

This project is not affiliated with Polars. The design language was deliberately made very close to that of Polars to highlight the fact that this is an exclusive extension to Polars, and as a tribute to the effectiveness of the original design.

About GEOS

In order to save myself (and yourself) from the burden of GEOS version-specific features and bugs, polars-st statically link to GEOS main. This means that all documented features are guaranteed to be available. This also means that this project is LGPL licensed, the same way GEOS is.

License

Copyright (C) 2024 Aurèle Ferotin

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Metadata

Release files for polars-st 0.11.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 polars-st 0.11.0
File Size Uploaded Provenance
polars_st-0.11.0.tar.gz 316.2 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for polars-st 0.11.0
File
polars_st-0.11.0-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details
polars_st-0.11.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
polars_st-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
polars_st-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
polars_st-0.11.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
polars_st-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 319.8 MB

Release files / polars_st-0.11.0.tar.gz

Download URL polars_st-0.11.0.tar.gz
Size 316.2 kB
Tags Source
SHA-256 checksum
How to use checksums
539634cd674437a6dc313b37af0944ac41b22d262c41fabc652186cc84573cf4
BLAKE2b-256 checksum
How to use checksums
b041fad12cd0138e6583cdd09c2d486da2fe64d88e3221574d6470d28511ccbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / polars_st-0.11.0-cp310-abi3-win_arm64.whl

Download URL polars_st-0.11.0-cp310-abi3-win_arm64.whl
Size 49.3 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
6a2d483212b874737a1371afae1543844fa3638d26d3485a63a496f43c1b36d3
BLAKE2b-256 checksum
How to use checksums
08ebb4beaa9ccc4816f622910fafa06d68ad38e331a3f4513c4b32e3fee71c89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / polars_st-0.11.0-cp310-abi3-win_amd64.whl

Download URL polars_st-0.11.0-cp310-abi3-win_amd64.whl
Size 55.1 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2f8e1b5ff78d94b86390b49a015ec352335be354674bf3e4bf1289eaee7c5762
BLAKE2b-256 checksum
How to use checksums
ed9ab013c3e5ba33c2b35e2719c942dfb943ba0d35ddf6c1e795e1fceb8d622e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / polars_st-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL polars_st-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 51.9 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
08bf2a3ac050c95abbdee39e2f078ce581ffb0351d97722175ff1cbd79439a3c
BLAKE2b-256 checksum
How to use checksums
1e181515a86825a54d630ba2a45d703603e7696f8947e667583525a85cf67a23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / polars_st-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL polars_st-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 48.2 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
def388a85724399fd281e88f65408468525a61aca318e0d00b7c675ab2e620a5
BLAKE2b-256 checksum
How to use checksums
f2bd4995af890a88e8118c5ab83064559c4398df3267dcbf95638111b0e770e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / polars_st-0.11.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL polars_st-0.11.0-cp310-abi3-macosx_11_0_arm64.whl
Size 56.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fa4fdd0e282f56bad2da3b5f81237423170eb9165fbf686ee6e6ed11364ee91d
BLAKE2b-256 checksum
How to use checksums
1b9f10b21eb6f1692b7580c9ec4f34d093899c5d7fdf4f0fb43879df5b1faa87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / polars_st-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL polars_st-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 59.0 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b63a230d59c9b6077b45ca94661007cf3ad269617fdecf5e919970e71556021d
BLAKE2b-256 checksum
How to use checksums
761f4c9e016a60bbc1543b8cd8b8b09cbe9a983265889f221a55ba0fdaf15d27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Security for polars-st 0.11.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.11.0 This release

7 release files No provenance

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