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.0.6rc5.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.0.6rc5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.3 kB view details)

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

lsst_sphgeom-30.0.6rc5-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.7 kB view details)

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

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.0.6rc5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (884.0 kB view details)

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

lsst_sphgeom-30.0.6rc5-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.3 kB view details)

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

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

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc5-cp313-cp313-macosx_10_13_x86_64.whl (631.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.0.6rc5-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.0.6rc5-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.0.6rc5-cp312-cp312-macosx_11_0_arm64.whl (600.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc5-cp312-cp312-macosx_10_13_x86_64.whl (631.0 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lsst_sphgeom-30.0.6rc5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.5 kB view details)

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

lsst_sphgeom-30.0.6rc5-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.0.6rc5-cp311-cp311-macosx_11_0_arm64.whl (594.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.0.6rc5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.6 kB view details)

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

lsst_sphgeom-30.0.6rc5-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.0.6rc5-cp310-cp310-macosx_11_0_arm64.whl (593.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc5-cp310-cp310-macosx_10_9_x86_64.whl (616.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file lsst_sphgeom-30.0.6rc5.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.6rc5.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.0.6rc5.tar.gz
Algorithm Hash digest
SHA256 9e6f16e2ae367693b0c0d36398b591922ae59e87982381616e141a21a16a6581
MD5 0491db17290e2fdfc9f28880bad2913f
BLAKE2b-256 83093ab89956e4ca838a1ee5dfa0141efe888a4752370e0d248ecb8735165d10

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43f0d6db5d2091fe45311c7600c6ab7db3f44e69b6b830ca495bf3fe7e0492bd
MD5 a337259476461b9d6fc801c9c947c60c
BLAKE2b-256 ddb98db9e80f951fb885644695f0a0397e7ab800f0a4adb2b143fcc3ca1ab4b8

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c0dfc331db91bf5429e622e661ed187e86a13a9574620d46abd8c5902347ad07
MD5 a76ea7aa2a492b9ac1edfbc75b647da1
BLAKE2b-256 77a4058f5cd99a983ce04aca4827409010f5b91256683dddebf899dbb0c7e821

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a3f95b0bec154536c7e9b5935537ab5ea2aca494e28aae5a2563432b100168b
MD5 9e760533bb0b884c4531b255a6b166b1
BLAKE2b-256 78eb301a447a409a581153d3ada779ad622754b51fdf52c6f44b2c85c86dd0f7

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 698b60aa0981d55685834cc553440ec24988257dadf56d5801d8b7ee3e44d4f7
MD5 f9777d2ff109ab6754e138b1fa9e6133
BLAKE2b-256 a93dad2314c5aa5d72ce2e0ced3c3bf6cc5c745d47f7808e17c9707d6e97a743

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 93f7d8abcdffdbec82ea111b4d1802670b577f467ab019839c1845487ef3f322
MD5 bf46b038f78265e228f391d97ad69694
BLAKE2b-256 6a67a97bc387eb8bb1ac164acf7d6303bf3d9d1d562f7606c517554810c8e1a6

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cb9c1701a02d80a68dfdf15113f9ae990d94a9fba51537854e86cbc8cb730f77
MD5 4857aba73cf52fd7faa4119b6af2de15
BLAKE2b-256 5bc6d2ddb1bc8c3c2b6e81e20c16a18bcddfc238218c13abf87e6cb2e4633eac

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7184f9debe768bdc2fa0bf936fe19d97c34bd2dba488bee7d29151a901e0bfad
MD5 f476a420f468b79b5bc5f3f03c873600
BLAKE2b-256 b72d1b8dfb2665730170d5544d9e155ea293247401feae8522a35496a98646b6

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 fd0d32c0b2c59c1d3b2ad8ccd9ef88fc7503319be1f97243298e757bdeef61d1
MD5 7fcd4a6b2ab8bb81648a3099fb264f96
BLAKE2b-256 919fbdd60f976daf350413a2f9a85b987651eb3e87478cdc4820b1e03e6feda3

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4aaf9f104c13292a1614518cc0f6feeb75454edd2544dac01dfa92f4c98d77a1
MD5 64dcae92cef3c2361ac334bdc0ccd585
BLAKE2b-256 c097d150f074b75317b824ad3f5f276d816ad2157c964b06a40b15be68b31f30

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 24d1a97073ffc381d3faf55f5151d0e53c0a662100603c053fc16a06c69fa517
MD5 896be2485ba9f96d80e3fae25fc80e9d
BLAKE2b-256 dcff67b01df849df21b09c947cad5f61fa95a9dbcb7d89238d92a1ea5004941b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d10a689ea5060332c0089e03d12bf8a9ad58be575e3a8ca7f0f626b0d7bc3610
MD5 1f2502e722f28365bf41d846b8ccef87
BLAKE2b-256 69c1e5df13f1025bade36103660366e077af4d660fe74a8ecf49b2892d2cf6f0

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 62d3d313b5ca56f0545be44cc1fe8a9978b68ddba79acc086ae4773c80c3df09
MD5 9a154ea3fd2c5a683cf70316aae4a766
BLAKE2b-256 41ae60f66e129856fb41a28e533ef7c9004a364f4f2206be2231a5efa0e6bd1f

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b24062273427d14c1a92679bc3f229b141d57753130a5def07cb66baef58bef1
MD5 4b3cba979f9c6ebe25046f81c95390d8
BLAKE2b-256 053a4ccd98fe4b45a9779032ece182cdd77bbdadbc15881b54f9693e99c7603b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b0ed7ed2f4664e9a112f6bb41b603bd22446fb4a60315d45bab6ce5ba1dcad45
MD5 02e21f1d1f6787cc11f2880550940bef
BLAKE2b-256 94de66bb12621befa8e9db0fa8c15e86e9f1cd711807d9ad6ec8cd50d6d8bac8

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc9ddf6c02300338bb2a924342244d454ccdb84784890ebfb2bf6e41ee1154ab
MD5 ea9ff450dec9a122f9e993275e9a4e22
BLAKE2b-256 b256b3b302ec8198621764fbf8bf1fc2869d0302b755fc40b3178a55a8b2adf3

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9cf1310afc6baa9137b7252fe6f3d926f87336e7e1c1634e42ece50dc6d0cf2f
MD5 d90f5a91d3fa2e6893b0a16d0096e84e
BLAKE2b-256 b60303e73f0b7380bfd25d817c651d02b1d783967783e2035738af6eaae4a43f

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5a3802f71438b51854fd18d870cee8738ad1dea0eafcd1d7005167be4378a5c4
MD5 c0be2116c9dcbe3b1f0cb3147f4859ee
BLAKE2b-256 3c7f965984a304c7d8500403b13df392e0fa05a815df1ff6de2ac321d5a65944

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c947cd5bb04f5ac2b67789958760d2f740a504dc9f02ea8b7d5c67d62cdddb46
MD5 d687da3b15454ace4cf96c1bb9837e49
BLAKE2b-256 20c6493255d3ebcf92fb8e986dfadb8a0d41b0a5b9abd5ce58a24dabb2d23890

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 486acd32a8c07986b9458a4f2128d09f8562fcb00ecf8decc237b5c3c0fd48af
MD5 15974b4e43c0acbd7770242450eb9983
BLAKE2b-256 c2c980451edcb7e1c67150e607cbf9f9dfb4338fe86f911ef72797b1b46fe648

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc5-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ddc72c358783e6a1139d2b19068f1b8f3a24913de2bd453e30b4aa36f4b00fdd
MD5 53da070629b32083876d461632f1d851
BLAKE2b-256 bd2d4339fb7fafa61e64a91794bc86f6b90b99cb846f95bd74fc794c1869ff2e

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