Skip to main content

A spherical geometry library.

Project description

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.

Project details


Release history Release notifications | RSS feed

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.1600.tar.gz (162.8 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.1600-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.2 kB view details)

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

lsst_sphgeom-30.2026.1600-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.1 kB view details)

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

lsst_sphgeom-30.2026.1600-cp314-cp314-macosx_11_0_arm64.whl (602.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1600-cp314-cp314-macosx_10_15_x86_64.whl (629.5 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.2026.1600-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.1 kB view details)

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

lsst_sphgeom-30.2026.1600-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.5 kB view details)

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

lsst_sphgeom-30.2026.1600-cp313-cp313-macosx_11_0_arm64.whl (600.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1600-cp313-cp313-macosx_10_13_x86_64.whl (631.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.2026.1600-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.1 kB view details)

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

lsst_sphgeom-30.2026.1600-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.9 kB view details)

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

lsst_sphgeom-30.2026.1600-cp312-cp312-macosx_11_0_arm64.whl (601.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1600-cp312-cp312-macosx_10_13_x86_64.whl (631.1 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lsst_sphgeom-30.2026.1600-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.6 kB view details)

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

lsst_sphgeom-30.2026.1600-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.3 kB view details)

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

lsst_sphgeom-30.2026.1600-cp311-cp311-macosx_11_0_arm64.whl (594.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1600-cp311-cp311-macosx_10_9_x86_64.whl (618.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.2026.1600-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.7 kB view details)

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

lsst_sphgeom-30.2026.1600-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.3 kB view details)

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

lsst_sphgeom-30.2026.1600-cp310-cp310-macosx_11_0_arm64.whl (593.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1600-cp310-cp310-macosx_10_9_x86_64.whl (616.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: lsst_sphgeom-30.2026.1600.tar.gz
  • Upload date:
  • Size: 162.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lsst_sphgeom-30.2026.1600.tar.gz
Algorithm Hash digest
SHA256 0aaf5d9b018ab380dea06dccc6180bcbc6f4dbeb6d0091c8c8d91edfa4da5f3e
MD5 d1c9d72e6e25fa534870ed106b77ec03
BLAKE2b-256 32ac504ff01fcd1455734635b7fb5b083540287202d6e3bdc34d86e25ae9d37c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f27a6df509ed000d549523ac44cad08052a1b76e5097a916ac8021ea40fcba1d
MD5 f056595783bfe5781788680a7064a7e9
BLAKE2b-256 8b6975aed822d56c35f2c2f763ce792e9f3bf314a7526da7112592924e10ae8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4dace5634154cd16a057cba711fa1f7490c4e0ce879664ca26ba5fbc89fdce4a
MD5 8a6d191d3412df2d31283beda1ad390c
BLAKE2b-256 6f58875f4f9979186c11167a00de156ce6e20928716ec7286fc417547afde12a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8492598f2e02eb6094b91aaf84002998a7cb5b0f5a946b3e1050d464e41694f
MD5 8e61bfef273ea4da72e2b4e89378331b
BLAKE2b-256 61b66a2f596e618627186e07f0045592b79a331c98611a3ee4b57ba56ed1bb66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 64add026bbca741ed455ef2716f5292b69bf1b7fe8d85b25933a7d8bf3981d13
MD5 8cdb14c38ce5cca2035b652d757f6491
BLAKE2b-256 aaaa91766029c5a0c59e02ecd67a3c5416d71fd126a9cb18bc1a7e2e3c919db7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3f35953fd1e8c017d4b33eb3b23e60e251891699e054472326c2eacc6ed547d0
MD5 7b55f953b04d736a2331d6bc7b65feec
BLAKE2b-256 0bcc6585f3b47dd4950af93c7b47f3feb0ad289b6dc55ee797c0f06180afeadc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f360c7d54a8eee10477bce14ce22f185a7259d1b9ca879a5238517eee909e778
MD5 8214c88dec28af26e6de5070b8d9717a
BLAKE2b-256 243284e663dd9b6dfb258f8ad16b124550b4c59cd7663455b318f4affb7d3639

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fad12b453b7251dcd95a0c8ab4b6b5678335b2ae19962f171dfddd22f09e217
MD5 715d67fa7df46b55083b06b1ebb87838
BLAKE2b-256 0566ed681113aa57b67beca4620a5086a6bccce99b97ac60a6ac203d765bc210

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 da79506c6ed862a15fc390b14be6630ecd1812ee9725fffc360fbf22ded370f1
MD5 6a926e66b571e1843e35d2b89aa8912f
BLAKE2b-256 b7d5781c4c321b3f66488c1740f208ebd235fe4288764d3f588b4a06aa97f69e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5ed375f8e2466aa3ed91778e8089d5b792d621cd7e9aa74137009fbf1be5c54c
MD5 bada62274a55b6a082df0cfb982e9c79
BLAKE2b-256 e95e47d7139294bab7ab4990656d60f21ae418dee648fe9aa3cf5f8c53fa7f7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7d7211a6b624f40a895a3a1c7bdbf47f6cbb2b5ab46dff60121b92738c9e83d2
MD5 129fe87a2f560ae426b03323062c3cb4
BLAKE2b-256 6c32e1869754b17e3c005a0656cab23e9e32bd3b068d209300eaa77f66470319

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff4420e17ed671d6ceb4adf4c812392edb47f53bd85c057a26452d585484fbdf
MD5 ee3500247cb81b2e21c495e06251591d
BLAKE2b-256 c4f0287db86178c9e5a90a717d35bdd3b592731b55b051f0b6404ff2b8218b9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 cd4bff7cbda213d89a6405c9f1d627a9f84083671bc243edc2ba5c6e3fd76ab7
MD5 135a0c0a53781d190a1624dd0835934b
BLAKE2b-256 7586a02d8eaedff51f4d8d3e641303dbdd9694d291c98f8abf59313e488f7b8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b3807419bba71a5f57f1bb91ce60dca53eb81fdfc84cfc82d8f4384f12890369
MD5 ada44610f3560989964d83793fca96e0
BLAKE2b-256 350ab0266c600dda6cebd7dfe61941cc4a228f676b858ab8180d7bcf4a91286e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7eed234f86ba45f674b6e9a943bacb382af0ab6c9abd344f2838a578f8001ab3
MD5 997cb13015c62d33bf944b9dc1a4b254
BLAKE2b-256 efc423743ce36a1bd13f80587aec5eb25c68bf437eaa0e634498719545f72d78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 490e06af76725360a1d9d7bedb0623e53a75ef1207875632b0b32e5eb62dca6e
MD5 92743bb176901afaef0ae2cf7c04e59d
BLAKE2b-256 d7512b694c747d95bea0883156f98004456d3234907752f2d0a48d97b75f5f24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ffcd031aa01359eba5fb75062e475c83bc0127e8770b2b70abbcf7b6ce600f23
MD5 a2836ff69ffae13f596a92cf8fef4903
BLAKE2b-256 89c551430f5cff14430819521cd61b4dbadcc0b407e162cc3957c232f2d78ef7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fff028e05bb0e95e8daf01771a1c5eb5f05580aeb49f9ef8c891fcd6517b6e69
MD5 28ab80b8f1e42f52cea9eb5571415215
BLAKE2b-256 4674617540c484b508a53b0dc46f0f42b54feae1837750bfafadc45b5f5cf224

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cbf08691019e9289fcd777db75623061c3e0b0633f8220077bbfd9c0a83aa065
MD5 1d4171ad7c6766ac24e75de685334fa1
BLAKE2b-256 8631be23322f42ecdf554556044ac8e5f43f559ce2e815590a985356f66ab8d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edd6e2fb08dec7392d14643f8e1c09fd13180ef3569d91fd49ba65637adbf956
MD5 e17ae3be5ff569d7fedf0f752511484d
BLAKE2b-256 4b01a383a4d2ab8860980117a649b00e440a9da6998b487c8a4e9be8a17f945b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1600-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c07507ef6ce3ac9be7806f828b61d6243754c0872c5e4fcb165da697dbaa9093
MD5 12f3d12ee28d0d0e5363a006368ae8f6
BLAKE2b-256 0e8f0dbc57328e368638bae01a4fd74b2799f64b4a9cb4ffbdbf4256624d1df6

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