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.0.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.0-cp39-abi3-win_arm64.whl (1.3 MB view details)

Uploaded CPython 3.9+Windows ARM64

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

Uploaded CPython 3.9+Windows x86-64

s2rst-0.3.0-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.0-cp39-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

s2rst-0.3.0-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.0-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.0-cp39-abi3-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

s2rst-0.3.0-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.0.tar.gz.

File metadata

  • Download URL: s2rst-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 5cf8bd465ed660f0cc0933eb6941447e7deb18b22958128c21365fbc0714ade5
MD5 38a69efc1d1fa7804094de1a98c72904
BLAKE2b-256 f88a9268caa86cf7e073b8e77e1465984e4755b031b9f33a58a1ede836926bb5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 5917c3bfa0dc51ff3d51c8be6679124142142780854fd93a38324e158329fd68
MD5 27a37fff45f3d14855e7eeaf70c5ecdb
BLAKE2b-256 9370d23236b96d92634f79d33e1c095eacdb5e3dbbc009bcbb7b62f2661d9fac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d29ad5ac25f9f9a7d44f0497f0d2fbc0ddbcbbcc7ffc4cd0964ee6f61ae6be44
MD5 8ee5cb9b5cd3e103d2ba3a58a5dbc89b
BLAKE2b-256 107ddffb64ed31f31350d388b3d2657ec21db5441743d355f1d87c946e28f3eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8b4e72eee97fe825451fced6569eed6a72db8b757fe59557a43d4e33e0f658cc
MD5 3d3a36b4d7ad3b672df9f8c7d210457b
BLAKE2b-256 ac3cef3392cd37475e717e179a9187931be924034dcebd53147a664a72abf9cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 2b9310fe09154b419fd90ec2c554f3f6309652d85232a12d9a902ddd302bb238
MD5 158e8ca9570adcb6f416feabdcaaf8b1
BLAKE2b-256 5221d475dd0505e3f24a545da189fcb0871c6d776619acf4a4ae1d3ff114fa6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd4807b893db75ad1fe93d2e67cc8d121955f97c8827c197569763a5596e7888
MD5 69b251f1cc239049890868a49fe3d897
BLAKE2b-256 a00cddc3ac939093d7e02b4905e753ba436c82ce0ac921ec97b0f8a31771325a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db183500da79a4065e77aab3561ac90f97cdb5aea394ba46c5bc58671c044fd6
MD5 86592696bd1f9a0912a3b0bedcf16098
BLAKE2b-256 d9e958976ac885a19f8d08923a080cb73008cc77ec9d05a2c0e84be0bc235b7e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6564071302739dfeaaa411b65573099b14dd4bbaa690acbde14e9b5568f4bc35
MD5 8d4503cc4eda1b534c3724f2ebb67cc5
BLAKE2b-256 d9fad00c651205ad89308208f5aadc8999e5809a1b1e9e22cec5edfeb6fb23be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.3.0-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.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d93b3d0db2278cdc3291b31ab49f897fb42967b970849c0b70f74cc13b2123f7
MD5 eada0260391e000e36a523572b1c189d
BLAKE2b-256 8ffad3e23d239e56f06e5480a87a345e767ed2d7efa99b8966c6e15aae9798d4

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