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.2.2.tar.gz (980.8 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.2.2-cp39-abi3-win_arm64.whl (869.1 kB view details)

Uploaded CPython 3.9+Windows ARM64

s2rst-0.2.2-cp39-abi3-win_amd64.whl (947.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

s2rst-0.2.2-cp39-abi3-musllinux_1_2_x86_64.whl (1.3 MB view details)

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

s2rst-0.2.2-cp39-abi3-musllinux_1_2_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

s2rst-0.2.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

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

s2rst-0.2.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

s2rst-0.2.2-cp39-abi3-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

s2rst-0.2.2-cp39-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: s2rst-0.2.2.tar.gz
  • Upload date:
  • Size: 980.8 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.2.2.tar.gz
Algorithm Hash digest
SHA256 0bde89ea20f117edd5bb736347bc3ce153341f6fc74e80066a1b05674a963f34
MD5 50db8f1eb492361a2b186b2423189186
BLAKE2b-256 7989081d2cc06ee468b3066781bfc1b027202769302bacb5c35524d115852cda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-win_arm64.whl
  • Upload date:
  • Size: 869.1 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.2.2-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 f7a90d931e1342c5cae646e72c2b449b7bfef462669068839a2e3a56cf4af04e
MD5 425ef1dad935e8ebc1a1080e45db595a
BLAKE2b-256 74e9be5912ce9664178ee26d6c8bdd156dd843bff1f474af24d9c42175e96ec2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 947.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.2.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dcaa68fe47c209a1260133038ee41e4c0990f4b54f0d1b952bfea21f9cb1cd89
MD5 7ac73397e7f5d2b7a625b1b20501b566
BLAKE2b-256 4d7328ed269f25c99305f239c14d38584e7f8925af7d2575f06ea3c5304774f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 1.3 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.2.2-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 052a7695bd7db1890e7fe9f52e6757575ff1a12ad0cb62dbe4bffcea43e810e7
MD5 a4111fad79ca9a0d68fa997d4089edb4
BLAKE2b-256 1c0b2f3c88c61174e38577a940ba59afbf3eb15e876c3d4dac1bd14d04d712bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 1.3 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.2.2-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ef9b4fd0834e7db71745b2338cf19ff69499ad085dda0b23cac5614f3aec3b81
MD5 4c916a37d18535ae91b67acd6b0fea90
BLAKE2b-256 52b6636c2f93ac46b83e62344e51efee8f0907cae0fea8e374f200a629995838

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.1 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.2.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da19d32420710f89599833ac1d3a119ba4b4e20c628a129730acb6d550bfa34d
MD5 0f5d1c3d12d275dc969b2cd133403807
BLAKE2b-256 fe291c89a16577d5c326035cadbb48c3ca2ffd632c4e9314ba4b6b8d55d688c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 1.1 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.2.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2fff0359c9ae32e4f5fc2795bb582e7fa7fa3151fc7895527afa5260388dda4d
MD5 631667075a21e26b490d97a824c140d4
BLAKE2b-256 6f2e41c62fa5ccfafe4af950f7681551981b800039e0e1be277965678ebab4e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.0 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.2.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7f0c4bfba195ba03af5e8f35384c18597db40b9146584ec1e09a5e7dafd2d3b
MD5 46962eb681dc63db117c288040aec597
BLAKE2b-256 e3ec221c1584d8dc15f3f934c4a07bd3d6283a026f195f72846b52f65489ff8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.2.2-cp39-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 1.1 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.2.2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aff83465400531f41eb1bffc9a314b72c971ab5cbf759fa7069cc8defa3211e9
MD5 d3a21b47d11cdb95d11b27da073c6744
BLAKE2b-256 0a5c41670b38a29c611cb76b21f0a934175afd425f227fa7440c1d1754a768e4

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