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; S2 is a trademark of Google LLC.

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.1.0.tar.gz (943.0 kB view details)

Uploaded Source

Built Distributions

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

s2rst-0.1.0-cp39-abi3-win_arm64.whl (748.2 kB view details)

Uploaded CPython 3.9+Windows ARM64

s2rst-0.1.0-cp39-abi3-win_amd64.whl (817.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

s2rst-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl (1.2 MB view details)

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

s2rst-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

s2rst-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (959.1 kB view details)

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

s2rst-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (944.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

s2rst-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (879.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

s2rst-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (935.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: s2rst-0.1.0.tar.gz
  • Upload date:
  • Size: 943.0 kB
  • 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.1.0.tar.gz
Algorithm Hash digest
SHA256 dac5115bfb2ed1ed5d95879444037640aae3ecc95871d5419b20ff46d5cb0776
MD5 42e1df37e6ae5e3cea56ee90b8f319c9
BLAKE2b-256 f8153e1f394c8b29fb06452a699dc0e1931acd1debf49778dd9cca14c3202e88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-win_arm64.whl
  • Upload date:
  • Size: 748.2 kB
  • 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.1.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 48c7a3e2dea56a6400382afca86a2c27a300a514eb4e0e5cd8ce922a91185724
MD5 ef13497b3723baf5ed43b21f57d51ebe
BLAKE2b-256 7b6d94a5944e9194b01c8b31b9cb9aa15c883ee5d1598e0fe61bfd9307b353be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 817.8 kB
  • 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.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 72ddfede0369c4e692c7c6b3114a378c8c470600db9b0d16e0c8088e50a5d3f6
MD5 457370e76bbf6abe6bbc9a60b2218aea
BLAKE2b-256 45a2dff6cdca320210e011d6a52710bd65dc292fc57d9668256d81843c12184a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 1.2 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.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5baca292da072af920acbc9046436845965b4bdfd730937ee340757ce9a93a31
MD5 f94ded43923bd42d7d6e435952e7c5fd
BLAKE2b-256 a10051db5f15076b6c052a93848cfc790b4aaebb397cc6cecd813c7ab50a8461

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 1.1 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.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fe12477c10abf7686dcb34d972e891b1e5fd31edc9af88079e11b10d65f452f8
MD5 50dcfd0285cd73a4d67a61505bba8cb4
BLAKE2b-256 a9363d176ed690004a5580aae9b0b7a39d243277e6a142c523623b59ee3fda08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 959.1 kB
  • 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.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 501fe4572ca4a052aac86d71a7aa53c35f8ccc8d75246220d8dbf35b59957f92
MD5 2828b41cec4e2cffc5c75a36b3227325
BLAKE2b-256 e69802dc6f4cab812f6ffea8f56010c7e6e8dfbeebd01dd911ff5c9cd02e31ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 944.1 kB
  • 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.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6020d26ad2620a8444a5fcaf7f3485575167852f566893fa2febc5d663d312f3
MD5 4909588d0819c3cda0cae090ce9409aa
BLAKE2b-256 d65dd6adcdf21a456e0e2f4926f507804c2bbd2b7521b1790d19cb942243692c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 879.1 kB
  • 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.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 885dd96ce023a3085788087d239012331b937a1df0958d938620b4f059ce73a0
MD5 ffdfc180f7e4239157ffbbd987fecb96
BLAKE2b-256 898b8215e5d0d524f9cb2d99897c84b291486b23836178e21a16f0250cba7f4f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 935.3 kB
  • 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.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a98ad27feb2fad64a5c3aafeb52baa440992596584d031c7a48e8af9d199c688
MD5 81f0ec0b37f225f9e0c497dd0af38587
BLAKE2b-256 09a2b36b1bb543ec83dfbdca4d1ba9ec94c1ee692ded555c1e7a838fe7aafd44

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