Skip to main content

Python bindings for s2rst, a Rust port of Google's S2 spherical geometry library.

Project description

s2rst — Python bindings

Python bindings for s2rst, a Rust port of Google's S2 Geometry library.

S2 is a library for spherical geometry — geometry on the surface of a sphere. This package exposes the core S2 types (points, cells, caps, polygons, ...) to Python through a thin PyO3 wrapper.

Install

The package is built with maturin:

pip install maturin
maturin develop --release

(or, for a release wheel: maturin build --release).

Quick example

import s2rst

# Create a point on the sphere from latitude/longitude (in degrees).
ll = s2rst.LatLng.from_degrees(37.7749, -122.4194)
p = ll.to_point()

# Find the leaf cell containing the point.
cell = s2rst.CellId.from_point(p)
print(cell.to_token())           # e.g. "808f7c"
print(cell.level())              # 30 (leaf)

# Walk up to a coarser level.
parent = cell.parent_at_level(10)
print(parent.to_debug_string())  # face/childpath form

# Build a circular cap (disc) of 10 km angular radius around the point.
radius = s2rst.Angle.from_radians(10.0 / 6371.0)   # 10 km / earth radius
cap = s2rst.Cap.from_center_angle(p, radius)
print(cap.area())                                   # steradians

Type checking

The package ships PEP 561 type stubs (py.typed + _core.pyi) and is recognised as a typed package by mypy and pyright.

License

Licensed under the Apache License, Version 2.0.

s2rst is an independent port and is not affiliated with, endorsed by, or sponsored by Google.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

s2rst-0.3.1.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

s2rst-0.3.1-cp39-abi3-win_arm64.whl (1.3 MB view details)

Uploaded CPython 3.9+Windows ARM64

s2rst-0.3.1-cp39-abi3-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

s2rst-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

s2rst-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

s2rst-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

s2rst-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

s2rst-0.3.1-cp39-abi3-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

s2rst-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file s2rst-0.3.1.tar.gz.

File metadata

  • Download URL: s2rst-0.3.1.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1.tar.gz
Algorithm Hash digest
SHA256 64166fb18a819ab4b841110e0be2eb74be675b7a6b9ce66d9bb52a023d18ad9e
MD5 a3825d0817704499721cd1e3a8dd6422
BLAKE2b-256 a1af2968dbf01b5fda8c10cde9556b200abab614ce069f7344b578a971fb7f97

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-win_arm64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-win_arm64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.9+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 ae1a111110c451a1bb0c3e000439fb2450944057e409ec0de3eec534699c4971
MD5 72fa0a57f3c22ebc764062e88028d2be
BLAKE2b-256 85d2c3d11e04071b19f481c6ff56ca73a90b0e7a04e4767bace24b21f931486e

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 10b2ec0a6edbbca83c234829918601b6887a2bf776963e630348e4e27456a99d
MD5 b38f0b229b75d92b229444dc7773a22a
BLAKE2b-256 5c2fd2c7659ff1d9489ca1a2b9dc9e2bcdf9073e9932a8256fceccb7771ccf80

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 50d125479b443823326b678b59917ecdd7fbeb4a7f09d9a228e87de9667e6201
MD5 b90c26a7f28c3bb399a9c47a3db1252f
BLAKE2b-256 f7cc206ffcd82ed39a7e476b4593474bc06dcd7c5b8a160f7179232dfbaca4ea

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4f3d31966da1d13b273f8a5558c2b67b127b4ae8c8d6075526b7aa8762b6bd32
MD5 babd5779568aa2f35290c70ae16d88dd
BLAKE2b-256 47f21329b977ab17f62465360d82418f408122ce4a67fea17a469bf7f5bf5381

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4886adc532a29a51873883885a55a52f77bc6ac4f033fbd46d58ba214d30e9a4
MD5 fa2aacc78afc37934432e0d5511fa077
BLAKE2b-256 baf29289f949abad1d084b1bc1edd25acddd4f87330559bc89fb8bb223c62902

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1166190be9e251e5fde78b5f7d7b8ba062eb9e3d5d5bfb763777aecd799a0b44
MD5 f76b8f3cfccc0a3b8701daa645c1d679
BLAKE2b-256 6faf3eb8c9e9cff1e42d7eb548123add0af0f985f4c646d654b4d84a2795d1f6

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 246b16f0a4a832d443568751d7b8a63949f538e13eef55104d18ec5a7d2d10ab
MD5 f3c992f069614a01fda31392f033a02c
BLAKE2b-256 49bcf6c9b9722867c5953a15478b09d1a76718347ce453ec11549db3d053b6d1

See more details on using hashes here.

File details

Details for the file s2rst-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: s2rst-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9+, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for s2rst-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f3da49687367e4f90a9562179d75c8d2ca7430b9ad9e4e02f69f7ee776a0e5b1
MD5 d6d79111a992bad5b439d03244d20f49
BLAKE2b-256 e988bb59d660e56c6dba8ef94500913f7d7fd4847d93e99055af1ec9d5d83b1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page