Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsst_sphgeom-30.2026.3700.tar.gz (176.6 kB view details)

Uploaded Source

Built Distributions

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

lsst_sphgeom-30.2026.3700-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.2026.3700-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.2026.3700-cp314-cp314-macosx_11_0_arm64.whl (632.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3700-cp314-cp314-macosx_10_15_x86_64.whl (663.2 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.2026.3700-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.2026.3700-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (996.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.2026.3700-cp313-cp313-macosx_11_0_arm64.whl (630.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3700-cp313-cp313-macosx_10_13_x86_64.whl (663.1 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.2026.3700-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.2026.3700-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (995.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.2026.3700-cp312-cp312-macosx_11_0_arm64.whl (630.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3700-cp312-cp312-macosx_10_13_x86_64.whl (662.9 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lsst_sphgeom-30.2026.3700-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.2026.3700-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (986.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.2026.3700-cp311-cp311-macosx_11_0_arm64.whl (623.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3700-cp311-cp311-macosx_10_9_x86_64.whl (645.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.2026.3700-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.2026.3700-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (984.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.2026.3700-cp310-cp310-macosx_11_0_arm64.whl (622.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3700-cp310-cp310-macosx_10_9_x86_64.whl (643.7 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file lsst_sphgeom-30.2026.3700.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.2026.3700.tar.gz
  • Upload date:
  • Size: 176.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lsst_sphgeom-30.2026.3700.tar.gz
Algorithm Hash digest
SHA256 0d36a53bda82a26d790515b207b8f5a1b3f69e26f4ffcde35d09a65ddf02886d
MD5 7cbb5e937cc7091447f6eb41fbb66a7e
BLAKE2b-256 efc6e04fb341b6145bc836bbf9b3696e23d17b5069b9115d3d634432a3dfc333

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 86f0dbc41c5e314afc0bb98f961c7aa8dbecbb331b8bc996260b0cb67c70079d
MD5 75823da4889ab207817149eeee015b3e
BLAKE2b-256 283e06986d602843300044bd0ba3fbb148e3582c15916c8752841ba083fbee79

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 62bf1613a3e79b85619dedc846575b3cb5cd9828ca318a6d1aedfe4557b08203
MD5 348948126721127b78b185d84b1ec60f
BLAKE2b-256 9a885295ae876d7b946d5e3c8233c44901d2e6d868fe304a959c8e6da3a7f86b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04d1e3fa0402202753991b78dd1c911ebf1142fe04606ac87ee86263cb4cd2ed
MD5 23ced8f77356eb195032a81826fe6f68
BLAKE2b-256 fd06a0b6e1b484a0127b7433345bdc2b82cab191e6e61a987a2ba9a48f1ff34c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 21bc28311b09acb94d52fc3635e562d5d002abc522abea7357c8e7569c8ce696
MD5 38b1a0f6dda56d0497111a22161f3eeb
BLAKE2b-256 3ba370815c4e9c4a30f1dfc91ce8efad50237a433556927434a7c3c11f6c5242

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 499cd33853bef53fe4699b5c8d0f74a8472c659bb514378ab81067b1cda21442
MD5 de7a6277748132edfc35e4c462aa973f
BLAKE2b-256 a380e093eb735826414a8f9fc5f43777da7871c1762eb8f2527f058ac99700ce

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 062691ea608a8124a321df457f6ddfbe8fe2601096735066ccf07abfc7b33b61
MD5 b2c283f5d22c97316fb8ef2e8a8e7b74
BLAKE2b-256 5e1485499bf0f9ffab8897e28bfcdf886c851ff4b76be29a74057f60b4faabcc

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d8291fd5d343fac13a44df6431a2be4a81e0e7eab21832f0ec404caa0da21638
MD5 1a8dcb4af3bbd3e2e20443e2459eb70c
BLAKE2b-256 04c6b66e8a999862d3bd06401d410d3711aca6e7c484220f2fc6b72acfc731ed

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f47ee5660da626124e3caf9d72a3c8eb15f4e9bae9ab380b44a351182eff418b
MD5 1e808efc009abcf85e95c0ac270e3f0f
BLAKE2b-256 d645f77b50c4f4f039437de9f49fc126fb9059525d61e5071e2ede814fdd301e

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 53befbf6f99326bc57c35dcfa77f25a0679dcd26813848f507bb38ee82102414
MD5 0488050e62d767a27b088af1a53c6dc5
BLAKE2b-256 548c5375a51dd4a8c5d01e41e19024154d2814561c8bcf076bf15c9407ca6d25

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 68945c8877f3e2344dff88a6dd5f0e75eebad157aca597783858c4705254decc
MD5 cabc7e4b9c5bdf997f514b3ac2b8bfc4
BLAKE2b-256 cb3f3d9c162470e28862682256fcb0defefaad5b415966a8679a4d79f218b26d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f04699f778c9ba31de4ee298fc391904545aeb3c69237f0fc3bf625eaeacd52
MD5 9cfac5542fe68e7286d196083528c17c
BLAKE2b-256 b44bcb5e4d91097fb6b683f4c9d914d424a20a60484e9f1ce0e35a451b601a00

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a12382a5b6f6096cf8930eea92cf427614fa3b2b35fc38ca661bc11042a2dc09
MD5 483224fbde817c8efd7891f3515578c3
BLAKE2b-256 38afb694c9cda496aa78a1d600082301456eafa87a0a7ea3375524ad6a537863

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 628135177614cd611c38d43e7cd80030f1c36ce4083982ad93150fe87093c7a3
MD5 f4f80cf17214a1f049d10fd1a2317b72
BLAKE2b-256 c7578d7aa033bb26e45587ae405f4311bea3458e47fb272ab84b3b1b83ff5c05

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 184983c5d9babc3aacbd98ddef4f4438f7e4e2028958499dd0af85d3275b8bac
MD5 3684c2ffa1c06e014d85cca76907fb7a
BLAKE2b-256 15898f321327768ff47855f22422e375203f22ec13d0647fccc40638e62b6043

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ace8c8067fc6843f9d9449d9e8584645c89436c0c3d1908f70d8b34b81209910
MD5 e224c2b9105753e3099bf82bd3bfffe2
BLAKE2b-256 b5cb18a7f705ae0592eb47a0a4c76b079f8ed893355fce739cdd01e2feca01c7

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f3e132497a57d8b61ceacd7210cd849d873cd2f865cbf5aed69831f35487a29a
MD5 e9ea74a23856145df7b06b3e11e8ab8b
BLAKE2b-256 b3456fc1282f368139cf98af3726e5c35005b7eeba4e2ce1affd6c80b3f02114

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b52319666b68c9e27bdb2644aca82054257faf129fc020a6ab707179d8158259
MD5 58314981d834ba8fbfe82bec77456a24
BLAKE2b-256 a248e6484e1d9d7fcd3f2e1302999658694aeea0827d17bbccce6627120c2dc2

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2039f61f15a54e7395a277cae5bcb7aeb7282df86bc86d11c0532e7a94c4be9c
MD5 a7e6832beae69dfb01234d76fd4d8ec2
BLAKE2b-256 be9388b51009922cdaeca96dc9e6971501bbcb361d3700fa18fa127758f01e96

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8870159393b86a458e8bcd9746feac41b998f7407e46df29d2c2935fd26cfa9c
MD5 9fb55355affdc4acfdeb304c53f4b7ae
BLAKE2b-256 14dddfee08151cd778300e3882a44fc28cc06870b6af971e650c37a1fe6c99ec

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.2026.3700-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3700-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b32301f69d7dafef411fe58328f072a02ea1a6b795b9a0e695a96879f365c3b
MD5 785e98b7d52930e8e0a5743772b1dbcc
BLAKE2b-256 4180d8c44d1ca013a661506d9bc3cec91fc16ca8138a6b8f5ed7b7af66a18fd6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

30.2026.3700 This release

21 files

30.2026.3500

21 files

30.2026.1600

21 files

30.2026.1500

21 files

30.2026.1000

21 files

30.2026.500

21 files

30.0.7

21 files

30.0.6

21 files

30.0.5

21 files

30.0.4

21 files

30.0.3

21 files

30.0.2

21 files

30.0.1

21 files

30.0.0

21 files

29.2025.4400

21 files

29.2025.3600

21 files

29.2025.3502

21 files

29.2025.3501

17 files

29.2025.1600

17 files

29.2.1

17 files

29.2.0

17 files

29.1.1

17 files

29.1.0

17 files

29.0.1

17 files

29.0.0

17 files

28.2025.800

17 files

28.2025.200

25 files

28.2025.101

25 files

28.2025.100

25 files

28.2024.5102

25 files

27.2024.4400

25 files

27.2024.4300

25 files

27.2024.3700

25 files

27.2024.3600

19 files

27.2024.3500

19 files

27.2024.3401

19 files

27.2024.3400

16 files

27.2024.3301

16 files

27.2024.2600

16 files

27.2024.2400

16 files

27.2024.2300

16 files

27.2024.2200

16 files

27.2024.2100

16 files

27.2024.2001

16 files

27.2024.2000

10 files

27.2024.1900

10 files

27.0.0

16 files

26.2024.1700

16 files

26.2024.1600

16 files

26.2024.1500

16 files

26.2024.1400

16 files

26.2024.1200

16 files

26.2024.1100

16 files

26.2024.1000

16 files

26.2024.900

16 files

26.2024.800

16 files

26.2024.700

16 files

26.2024.600

16 files

26.2024.500

16 files

26.2024.400

16 files

26.2024.300

16 files

26.2024.200

16 files

26.2024.100

16 files

26.2023.5200

16 files

26.2023.5100

16 files

26.2023.5000

16 files

26.2023.4900

16 files

26.2023.4800

16 files

26.2023.4700

16 files

26.2023.4200

13 files

26.2023.4100

13 files

26.2023.4000

13 files

26.2023.3900

13 files

26.2023.3800

13 files

26.0.2

13 files

26.0.1

13 files

26.0.0

13 files

25.2023.3700

13 files

25.2023.3600

13 files

25.2023.3500

13 files

25.2023.3400

13 files

25.2023.3300

13 files

25.2023.3200

13 files

25.2023.3000

13 files

25.2023.2900

13 files

25.2023.2800

13 files

25.2023.2700

13 files

25.2023.1000

10 files

25.2023.900

10 files

25.2023.800

10 files

25.2023.700

10 files

25.2023.600

10 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page