sphgeom: spherical geometry primitives
Overview
This low-level C++ library provides primitives for representing points and regions on the unit sphere, as well as support for partitioning the sphere. It can be used to answer the following sorts of questions:
- Is point X inside region Y?
- Do two regions A and B intersect?
- Which pieces of the sphere does region C overlap?
Regions can be serialized to binary strings, so that they may be stored efficiently in files or VARBINARY database columns. They can also be approximated with simpler regions - for example, one can ask for the bounding circle of a convex polygon.
Python bindings that expose most of the C++ API are also provided via pybind11.
Points
There are 3 different classes for points
- LonLat for spherical coordinates,
- Vector3d for Cartesian vectors in ℝ³ (not constrained to lie on the unit sphere)
- UnitVector3d for vectors in ℝ³ with unit ℓ² norm.
Regions
Four basic spherical Region types are provided:
- Box, a longitude/latitude angle box
- Circle, a small circle defined by a center and opening angle/chord length
- Ellipse, the intersection of an elliptical cone with the unit sphere
- ConvexPolygon, a convex spherical polygon with unit vector vertices and great circle edges
In addition to the spherical regions, there is a type for 3-D axis aligned boxes, Box3d. All spherical regions know how to compute their 3-D bounding boxes, which makes it possible to insert them into a 3-D R-tree. This is used by the exposure indexing task in the daf_ingest package to spatially index exposure bounding polygons using the SQLite 3 R*tree module.
A region can also determine its spatial relationship to another region, and test whether or not it contains a given unit vector.
Pixelizations
This library also provides support for assigning points to pixels (a.k.a. cells or partitions) in a Pixelization (a.k.a. partitioning) of the sphere, and for determining which pixels intersect a region.
Currently, the Chunker class implements the partitioning scheme employed by Qserv. The HtmPixelization class implements the HTM (Hierarchical Triangular Mesh) pixelization. The Q3cPixelization and Mq3cPixelization classes implement the original Quad Tree Cube indexing scheme and a modified version with reduced pixel area variation.
Installing with pip
A simple pip-compatible installer is available. This only installs the Python bindings and the resulting installation is not usable for linking from C++. Some metadata (in particular the version number) are not set properly for the distribution. The main purpose for now is to allow other packages to pip install from the GitHub URL in their CI systems where sphgeom is a dependency.
See Also
Contributing
For instructions on how to contribute, see http://dm.lsst.org/#contributing (or just send us a pull request).
Support
For help, see http://dm.lsst.org/#support.
Metadata
Release files for lsst-sphgeom 30.2026.3900
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lsst_sphgeom-30.2026.3900.tar.gz | 177.4 kB | Details |
Built distributions (wheels)
Total release size: 16.9 MB
Release files / lsst_sphgeom-30.2026.3900.tar.gz
| Download URL | lsst_sphgeom-30.2026.3900.tar.gz |
|---|---|
| Size | 177.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7dd23641f24a28307e2b8b94960362fdbd49285a991e57930f84f9a7f524c001
|
|
BLAKE2b-256 checksum How to use checksums |
b4ca4652ffbc2f1b36ab20419d5b195f635cac42fc23ac83352ff6b0c1e0e55f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c382d0fdd70bf0aa7ab0f227c8f059285520ae310760e0ee9109035832af1a72
|
|
BLAKE2b-256 checksum How to use checksums |
30be28078113587fe441d7c6736e952fbdccdb28a10bf69bb117c215d8a22c3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.14 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
a41f638c758a79b9d1b2fb5fa9ecd722281b6a437aa55e6c3808209bc0dea05e
|
|
BLAKE2b-256 checksum How to use checksums |
bffd0c08a73adc010a30a957d7f65ead462259c703458e1c69dbb2f541c74ec5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 633.6 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
11e692cbb4837f42525107e9c35c2d5162dbb1c4768130093bec6f3cdb6cbe7e
|
|
BLAKE2b-256 checksum How to use checksums |
95df047ce9f1a6f68cd4f204cb9f3547206604ae727c99bc2fc8e7dea4d716a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp314-cp314-macosx_10_15_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp314-cp314-macosx_10_15_x86_64.whl |
|---|---|
| Size | 665.3 kB |
| Tags | CPython 3.14 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
f9f956d6a553c1f52ec71dbc255e2101ed6602ca51428bcba8ab89a689148f1d
|
|
BLAKE2b-256 checksum How to use checksums |
a7f5860afb8a8e3a9fe6606203250a40d70330854d4e94d64ea8138ddefe9315
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f8d90854f8d98cff59c9b557c252701055b4b4b821918160ce48bc948b7c7e81
|
|
BLAKE2b-256 checksum How to use checksums |
928d1e0f28c8f814abc69d2113af385a9d4d32c0f25ed2803153e4eeba4c6bf7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 998.4 kB |
| Tags | CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
8dcfb4037e71ca0fcb5296a08961521679abbf15d2e8f04f9a86bff4ef45de19
|
|
BLAKE2b-256 checksum How to use checksums |
8ca694032b151bf59647fed61da03ec79dfe59ae6b0350c48fa9c10551a0d2e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 631.6 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9cbe789af553931b1f069ccc8890c611c60934e5f820931e9c5396d1e57368d4
|
|
BLAKE2b-256 checksum How to use checksums |
8a38da334a80e5dc327078b3bf0cc1bf198eebb42cea20f18f6e9845d942f3bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp313-cp313-macosx_10_13_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp313-cp313-macosx_10_13_x86_64.whl |
|---|---|
| Size | 664.7 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
0f41f1d612c37e8cc7c5c3233eae74d5c4e0a89fce797f6690d25f607530d43d
|
|
BLAKE2b-256 checksum How to use checksums |
198ac57520868582432142b0aaa803538eb5cbc3c3aff9792d0d782c1a12ee85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
80daff7d8cc15948687e56c2ba0c2ab30f6657f9a5f8aebe5307326ae7576714
|
|
BLAKE2b-256 checksum How to use checksums |
afae5b264daa1f0314c8421d1527535000c71a22cfe1612992a9625eae48b29d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 997.7 kB |
| Tags | CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
d338cf10c91ff40ada248ec9df7003460167547ced9a56bdb32b45cef08b7f9e
|
|
BLAKE2b-256 checksum How to use checksums |
0a657ff5f1cae209e2c9e31f34be8d71eebba8d22140b9780b677da9b3a5573e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 631.3 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
73bba4243d2c32d022e311b203df4f8371aac22bfe1557d403c5429a3d93d7f1
|
|
BLAKE2b-256 checksum How to use checksums |
8fd880aba580105fbed133ec60ffcb782eef1b1f3d26f3d00bad0cdff2595e60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 664.6 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
0caa7e528da92242d155a9b884151dfc9f8d6e0dce3a7a2ea2bc406e93bbcfd1
|
|
BLAKE2b-256 checksum How to use checksums |
84aef4f02d362e4f14e8e6cee1b69613e365d4ff1e68dc43c18ae1dab3b076b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
bc07e980917584169d44c2fe17fcf2c024f6d9fb9fc1d39f1559ac684047d5bf
|
|
BLAKE2b-256 checksum How to use checksums |
aaf5349bf47e75c177cc7f0122c1e3fa7e1b09ab3258b48647fe7ca4831f3fc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 989.3 kB |
| Tags | CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
20c119594f67a01aaf24634c51924f41f2f7f4cc8270e0c1356d06a67b61ccd6
|
|
BLAKE2b-256 checksum How to use checksums |
ab5f8e9592313a59d4f3dcac0b7ec07de73a981db8d98d24b034e94f31135064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 625.2 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fed82639d01ac1ef615d6f7caa68a42dd05b84e584ad1acb5a2aedab6e0c18ea
|
|
BLAKE2b-256 checksum How to use checksums |
564acea3a7d6b117dd890b959e8264a45d4b5adca067a8081daa3acbd4743aa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 646.8 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
c890b16dd7d6ad0cf958120ab78d68c44b38abd98e1371fb27ffc5c7f60581b9
|
|
BLAKE2b-256 checksum How to use checksums |
9e227cae3cbcbe8b1a7ffa8aabd0ab4c2f458e7c7037c05fa63fbc345f850f20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
815a58150eb2709f4d915915a843704901dc93a93e076db6daaa950deb4ef2a2
|
|
BLAKE2b-256 checksum How to use checksums |
0947bdba73552708308f42139b449c1022118a853718500ed3d70e9dc28b6e3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 986.1 kB |
| Tags | CPython 3.10 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
d69da70105d161815e9e4192ea08f7c39bd0b2dfbb167dfe23c980e189d771de
|
|
BLAKE2b-256 checksum How to use checksums |
eac64c4f04f68c339fe94ac1c6767eee021d4afb3951ebdc49bbdbc70e56c84a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 624.0 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
71e97988f1b30a2e4a6d7e9e0ef0ca3ecd780a5abcba9db77f030b4b756c186f
|
|
BLAKE2b-256 checksum How to use checksums |
dc9f75c851661c7824d54cb92b11ef37c98bb4140151a4a470f64c268cf1c053
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lsst_sphgeom-30.2026.3900-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | lsst_sphgeom-30.2026.3900-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 645.0 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
7a67dee9c0500373a513f7fbee9f79ef05dc1a23f1fb53ff1339cdaa89fe81b8
|
|
BLAKE2b-256 checksum How to use checksums |
137d4a9e07e9426922c69d5c9537abe1b8b8b37390ab6bff494c7e61c6f68ca8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|