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.6rc1.tar.gz (162.2 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.6rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.1 kB view details)

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

lsst_sphgeom-30.0.6rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.0 kB view details)

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

lsst_sphgeom-30.0.6rc1-cp314-cp314-macosx_11_0_arm64.whl (601.9 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc1-cp314-cp314-macosx_10_15_x86_64.whl (629.4 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.0.6rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.0 kB view details)

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

lsst_sphgeom-30.0.6rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.4 kB view details)

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

lsst_sphgeom-30.0.6rc1-cp313-cp313-macosx_11_0_arm64.whl (600.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc1-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.6rc1-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.6rc1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.8 kB view details)

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

lsst_sphgeom-30.0.6rc1-cp312-cp312-macosx_11_0_arm64.whl (600.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc1-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.6rc1-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.6rc1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.2 kB view details)

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

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

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc1-cp311-cp311-macosx_10_9_x86_64.whl (618.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc1-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.6rc1.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.6rc1.tar.gz
  • Upload date:
  • Size: 162.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lsst_sphgeom-30.0.6rc1.tar.gz
Algorithm Hash digest
SHA256 9ff957de78b2e9020b25b625694f07121371a6612884f1b06d6548540af0b745
MD5 b19cf72ce6fc70a17c66d131f732db6c
BLAKE2b-256 0337ec95c9bc999eb49602aa73657a9b3bbf82a50a3ed33bbb79fb483a4768be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e97e36c27dbaece1b809971da5af457d9755c928dda7689eb52c00ec122b01b
MD5 00db6b9003b5cb744028b7184c01fd64
BLAKE2b-256 5ce4b0bac1ed5d2a55c6d0913aeaee1a3546afb51fa764e43a413856b1a84a9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5902b57196dddfe04a73b953aac27aadaa2aa022ff8ab01a9421ba38f2f43a5b
MD5 7e398132a29d7d6300492230ce19f971
BLAKE2b-256 0633bc5a35964044f5e111b4f2a5d5c817296e3078c276c1166d591ef9f5fa90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae25ae6baddab8555661260a38ef4cd41e3e10aafb10086fa16ee64e60ac853f
MD5 f36170d94a125006001c655e40f1d180
BLAKE2b-256 214f389893a8f01fd3236e6b76c8b660ba13c4c6293727ac2ae5795e6577d116

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 643fb09cbb6dc3b3ea55b9365af6305c0e22f977501e6a1d5debb324a14f5295
MD5 09da68ecb5cbcf1cf6fc6d9c7f90d542
BLAKE2b-256 4e1c8bb05330f3a19710c5e4ee400ffe76e0708ba8ba253bd2652f1406babe4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cea9da3a8257a501590a4b44d9719a2fe1db76e71e7fa92390dc2096c5973aa1
MD5 8b38ca4289c811b2df5ca389eee83f14
BLAKE2b-256 57ff28d8cc563d4cc1b822245298f1dd628d74d923719317bcb3a5e5f4b9e098

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 789e6a2a555634e13f49674b82d0e1d1606815c9c6566c7150a733175b823d07
MD5 21e3d4346997f178cb1027163e49fa3d
BLAKE2b-256 d03fef782d996526d6823e812a7532a3d177f4b9e9b5482b98f06f6a512073d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0dcdb97e6dd3a14a1ac491d4e2209770d4ce8385d4b07f2729c5efeda3fa78a1
MD5 d3475aceb1ff61e3b8b273524425dd85
BLAKE2b-256 ffc31e97275afa857911e848376ec26967e278a0d1f8a6681bbf73a3f765a43c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 bd3cce35eb34e37cd6fdb0eb2352e038bd5686d9cb3cc44fa7800e876811a3bf
MD5 dd44ab33ecee8bca08c057e94ca9f126
BLAKE2b-256 970e5c537663fcf7331e03cf8f536652104051a39d58990a1db78e987bf78369

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 07f3faff049e9b21a40e438f434c35b63705a23475fa5b0a881e9d491b14b7cb
MD5 237f56797c6cdc31103de00fbb248ca5
BLAKE2b-256 cc8c0c89a03b9614cf39d718afe967f80254fdc687afb9c07b20d29b88bac37d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c45349094697053a65756314a381438a66534ed060263a79e6870e5e184d876b
MD5 e0e6c8baab3acc500d62fdedeab66288
BLAKE2b-256 47ce3e48886c3f0cb7a76c3d0be374c6d0124dcca22e1ad27ed247de27da999f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8af4d0be15bf6dc1ed42c502ee6b6e29367b3c252d14d6454c5f29fc2ad1a592
MD5 7c640fb5aea50c2b6bab4600895a22e4
BLAKE2b-256 2a54202ee03a585ac07516112e111b78795b70d283bf244db9bbd379ace03a32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 94979d3361a92d24691ed4f4a7590face1f841464b80a3e8075442c67ad311b8
MD5 4b9857c4f69ee6fb5a90b587bc074510
BLAKE2b-256 a45b4ea13d407d7a0e47837d80cdcb36ad3c71d149ea7f4cf46f6b74bafdff23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d1252822f478190aaef77687a58ea637bcdf580cad54e31f61831cc47789ef00
MD5 64074849915abbb7a94682e3662a98e8
BLAKE2b-256 3ed6773c4f59f0eee4510b7d62267ad43c93e4f9b83f920019ee7baa64611559

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4630883fb8ca1335a85da63a1e12f3901145a9ffc1ccf12d4bdc5f9098b0009c
MD5 ec64af037301acc0512a98e71de93946
BLAKE2b-256 c8f5d5fe1fe2deb822bf2e1cbf99ce5686b5394310d9d4505a77a7de4313b28c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01e678ee87ce0ea9f1ba289c01fd4766194ee407bdaf6b31cd97b08b2a1a0dc9
MD5 978ea244e6d6cda102079e3ed99ebcd9
BLAKE2b-256 e5e97bd33223058d0b33f6c40a62349e72cf16d38cd878a3f57c4ab7df90cdb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7641adcd90eaafa166be28a6571c7b2ef42198c00d3ce66dba854e0a036e41eb
MD5 b20523ada06a653391e3f7e40a0b6e6c
BLAKE2b-256 559ea885a7478e4f07ef1cbaa4a1ed3b1abf089cc497db1dac70ffdbb06f7be6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 369835e47f91b1be96c480621cab03db2b650727efdbfdc8eef4b542b3c4dc0f
MD5 e12b763659039bb6af688ec08e467fd6
BLAKE2b-256 72a93223667ef27b6c26195e0649b6a5ecac262eeee162c9386575a44979d5e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1dc38d4eb4e278cc6ca1789b9e1947297a1ef2d79ebf9259d3751af6cbd07837
MD5 a7ae312096f98407327c7d30a5c0ba33
BLAKE2b-256 5f651cf4bd97ef9e66df8f63e293b17a5aca7613e8b6d02d0b9a749ad448c0a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce9d1066d68cd98eb6f08cc12de26a00bcb1774406b9c6cdfafbfb24771cad11
MD5 a1ead3c708a7b8763f589a7a834795d1
BLAKE2b-256 b6ab4f56f136539a23bd6581bb228522204187e8d9d0ce6c12bb3dd1ddb6a441

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3676ba9ea786a9998d388099710b976bd0380ad55d72add4baaf85ee8b4ecc30
MD5 505817b1253977badd090889632e8bc6
BLAKE2b-256 5c290c9c22619cf8a1b9a669af6e7b3645ee57793aea5c9283ef95f3852d7e32

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