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.4.0.tar.gz (1.1 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.4.0-cp39-abi3-win_arm64.whl (1.3 MB view details)

Uploaded CPython 3.9+Windows ARM64

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

Uploaded CPython 3.9+Windows x86-64

s2rst-0.4.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.4.0-cp39-abi3-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

s2rst-0.4.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.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

s2rst-0.4.0-cp39-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

s2rst-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: s2rst-0.4.0.tar.gz
  • Upload date:
  • Size: 1.1 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.4.0.tar.gz
Algorithm Hash digest
SHA256 111071672041d3618929c28470750a21540b44c71e2318c05363cf8960ff6faf
MD5 736c6d95270f1d4640edb5f89fbb0047
BLAKE2b-256 e48dc4da9c2de33bec380d0490c3ea8a3acda67ba391b7083421e15e448e9556

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.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.4.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 6327ce69d956ea8a27138a1908e2112b19cf33fad14ef667dd338ef6c9913c91
MD5 7e355f746aab31b02e18b223dbe13d10
BLAKE2b-256 9f4c0b379a9ef08e7c5443541ca95a20082eed83b612873b2f5952fac84f4020

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.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.4.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 922695d5c850abd3cfa16c4951d33fd88027d0016e7c2dbb51e5180f512fb5c8
MD5 1f2284b7711609d08225f02ae0078e2a
BLAKE2b-256 e589b00de98e95904691bfda46269ff39b7740fc9ef7d5f266c7309e5ed6901f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.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.4.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 45282ede39b6d62bd63d0e20fd896c0b7ae107d43b5667ecccf715efd37802c7
MD5 d8965d12bc88f61db27f18908e9a1b81
BLAKE2b-256 34523bcac6539257c962a3451380e24f5e900a09025848865d78dc3d22a33ce4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 1.8 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.4.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6507cdb46486c2eb99a5640b1f6c2b6479938c857b97de8b3b7c859b53ea846b
MD5 fc4c8904c4fea9cbfe4fb13f585e0b45
BLAKE2b-256 6e4283780a960c00f865537629f21ac594bc9494ef97941d1f004465b62b3368

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.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.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ba8b05646711a99b20cd1f919bca9a8774d8c0a4fe2f70d1284cbcac0e89cbe
MD5 e5ac8c7f8b5b17ebe88cb5c0fc0da9db
BLAKE2b-256 fc6fadb3616f5b034f9174f64f0d2bbc8d7f5eed752f5752ce97dee31eccc141

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 1.6 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.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 88d82ebf7256e7edc22d9cadcca62eddce1395c34092785f00ccd24f29e88db6
MD5 0c2905e4c6fc35bd7cd1105b2c3cbdb0
BLAKE2b-256 718424686a262a172ffcce47007d81932f658dfce86d409ea0ca998347e6531d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.5 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.4.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8edb3567146bfb70736adb84de72c69139e7721845e46c968e0822984c8f201
MD5 9ff4c87cd763f76c1d1ced1f5093e97d
BLAKE2b-256 71407a965d8e3c8876a1a9dee3085901936e43d8d4274d4a2a74ba7fca8743aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s2rst-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 1.6 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.4.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 67106f440e215fb71b96e9ff4302f046a0eb6a1969e32f5ad1c272bf99482623
MD5 0c0c55d5d7647d04c3d7f210c6e071ff
BLAKE2b-256 cd8ed96bea73ce9969d84981c728229759c361c5203d59d4fe8781fe3c554393

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