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.3500.tar.gz (171.1 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.3500-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.3500-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (996.9 kB view details)

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

lsst_sphgeom-30.2026.3500-cp314-cp314-macosx_11_0_arm64.whl (628.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3500-cp314-cp314-macosx_10_15_x86_64.whl (659.9 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.2026.3500-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.3500-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (991.8 kB view details)

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

lsst_sphgeom-30.2026.3500-cp313-cp313-macosx_11_0_arm64.whl (626.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3500-cp313-cp313-macosx_10_13_x86_64.whl (659.6 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.2026.3500-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.3500-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (991.7 kB view details)

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

lsst_sphgeom-30.2026.3500-cp312-cp312-macosx_11_0_arm64.whl (626.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3500-cp312-cp312-macosx_10_13_x86_64.whl (659.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lsst_sphgeom-30.2026.3500-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.3500-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (983.2 kB view details)

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

lsst_sphgeom-30.2026.3500-cp311-cp311-macosx_11_0_arm64.whl (620.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3500-cp311-cp311-macosx_10_9_x86_64.whl (641.8 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.2026.3500-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.3500-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (980.8 kB view details)

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

lsst_sphgeom-30.2026.3500-cp310-cp310-macosx_11_0_arm64.whl (619.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.2026.3500-cp310-cp310-macosx_10_9_x86_64.whl (640.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: lsst_sphgeom-30.2026.3500.tar.gz
  • Upload date:
  • Size: 171.1 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.3500.tar.gz
Algorithm Hash digest
SHA256 54f451e819a3ba4456b47e7402a51daa05249a2daafbc953b841f5c3dbbdc22c
MD5 6113bba13fe32f8c1b22fe29dcad665e
BLAKE2b-256 cc74d51c43dc7ffd841cfd23b7a4fc6d62caa1f251119b728c0ec48d1cf13a94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 baee72661d91e27fb29c1ab7e71f8f89272d42625ed53744b67a7acd434739bb
MD5 a78b77ddadae4451a3a3967373f99fa3
BLAKE2b-256 4e1eaf094c352f82590461a58d5e985135ef7acbfe8eae9ffe827245cad4bb51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c68f8ea0ddd8f838b0bc645827cf1e2ba2046a85fe14f79f22d54a4c5a7c1bd6
MD5 646e1121b2afd491d1f6471be0428254
BLAKE2b-256 35705a17bd49f6a0e597e9013724ec05d3b93efc7322a4d25171e41bbab7696d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 025a449f8c0689c3b77acc45c944b7f64f3a02f41cc6904703109d91b53980ad
MD5 f50355ede83af029b3b9bfe1a0161b47
BLAKE2b-256 924625c1d5aea37ed11bd0903ed7776b96a84914dd45294ab4bc4714c75547b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 465286f9c4e27ff3da04eeb90f8676896f0116d9c655a417f180ba64671d2527
MD5 3907d03af35407a78f659a7ff939cd2f
BLAKE2b-256 48df7cab4aa7e40d2e9b5cca2ad51e3e55fd5dedf264dd1a907ffdac9bc8cb78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 67050faf69b0fd8e497c3b087c2c40906606082e5418beea1260392daa8293fd
MD5 c97c265501974c77181e8a6b92965076
BLAKE2b-256 86aed4ff178f908f34c09c698a35bbfde54959ce84b07621821bb3564dfae0cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3efa1cb1ea6804ec60b8d5781c8e92cccdd732745e7365242544ae1aac4bc423
MD5 3879ce81523745a538a4bd6ea71a3cb0
BLAKE2b-256 e912c7e9ad0b87065615dffbf93ff81de37aa77d8ed0e9f77fa8cb5454980283

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7e96ee4e508b4834f625aff252b7583a34b8c784793f76d607a87d8d3bc8683
MD5 acadd2dab8b4517a746e47749ccd5132
BLAKE2b-256 b866546af5370b39be849df5e6ec469363bc8d60cb94899df93e0a56a9deeaaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 840ed1391560e6dbfa94917e4dad2af3ed17d0df78055c1d80f011ab31570e88
MD5 1b7980d433edea7db2212553a15c947d
BLAKE2b-256 895d643caf733a80daae76bc4e6c7147464b3e49171436e658730274a7740f9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0001a8bfb2372dd8f693c3a61e10c1dd3203975c6e50328f099b353891c2c1a2
MD5 ddaff50e369f7b12612337196e9041f9
BLAKE2b-256 099a686fd3dcc21acd1f57f59ccd3e817761587a7d8df3afab70408982c6350e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 74e11c44b7a64683a084066a003560e4c458170c8d4def852aa74e0143932969
MD5 db4bfb2d42a6a1d914f87b2cae2475a3
BLAKE2b-256 6d1c2167bf252eb7d50c884aa4e46ffb44515f21f6713aee10bbb298d9120d86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 261907e2f5f28143227889e185aca3da26d94d1e06804dafc1c046dbcc860aae
MD5 ea464e8b098bd8b8a4b00739e9a8ff0b
BLAKE2b-256 c949d64910205028ba7754b58db4b25d04d72f2fe8ddaadf50859847f9e2dede

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a1468b2eb28155b7b137fb34fb094260ea93b61fdf577da3bb06cdff6237bbe9
MD5 1bfd4c57d9a31e5e903ab06095aed662
BLAKE2b-256 e17286199e5b78a1b24c5a80e966654f9de7ba739dce2de17dcec20509673629

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8e1971a294b8d1fda3cd972b6fa983b1e5ce928be2411f6ddedf9d9bb5b644e5
MD5 784a2b89d843e9251dc056b03ed6c9f4
BLAKE2b-256 e29eb48af450fa46cd3e56f36e689b7c5fbf0d2093fa52a11bcb9710dd5e120c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7be1e56ec9d085f64dec2a979c40983aa9cd9ea650dbe89a0552411fe99ee2f3
MD5 c919469b4a7f7bbc93ec0b8386f3835a
BLAKE2b-256 f29345cc81091886254f39bb7fbc6dbeb816c3a0562502986f19828c362e913d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 911ec12f843717e9646fb0eb7691c4b8f4f61013113c525c3709fad4dd0b1550
MD5 0fae21730c951cc676f88c5a224b84c6
BLAKE2b-256 6a073b5f1d0086f1a4898c204bf111091860fed9b946c891a0bdd839797fc710

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b28723b7da77b17c91c16b7bbf67b2c7c0b98b9537aa8a6355df81d6bef2e549
MD5 6caa918d0cd085c356de6c0d4e709580
BLAKE2b-256 693165d9c0e091ebd627d7a59dc4153ca726038e9ff7d1a8422d4f1bca95e74d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 647490d9922f92a6bf67ae066f0a0445ae803445ea247be356c1e41436b61494
MD5 9ab865cecdcfa56d9c6201557aaa49eb
BLAKE2b-256 70118e91edc1f204db5c10ed4a62ce9fd8343e427293d731f75978f13475e4ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b10b61bcd87f97f1492efefa223327cf29067fdbf1c65758f85a3325de3f8d8a
MD5 da1d8036126386c76ba2c4a82de8fa6e
BLAKE2b-256 8ca3cc483dbd45f33692f7e85aeb372e4ae0868bd26c0cb80d5e7de59a3b09cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 673be41f49f28f75f9cee47fe31bbcc2079a9fe091b6f727d2daf8d8a988c47b
MD5 c4c7c762a7a4d503c1d2b14ecabccbfc
BLAKE2b-256 1729650f046dd9fffc5d0ae39158306d496f9872000f1586dd2f097a1eaec531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.3500-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 690e85476627f6f2a5e8d5ebc11643aa1550e9d1fe7f9b0c2798c0f21a86c045
MD5 2f2b77774b8ebf74d6aa86ef7cb86c46
BLAKE2b-256 02ee3a4d5ebf2405752b66b136dc48336c48cf7bdbcd426abd4a2a1d18ab3373

See more details on using hashes here.

Release history Release notifications | RSS feed

30.2026.3700

21 files

This release

30.2026.3500 This release

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