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.8rc1.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.8rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.2 kB view details)

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

lsst_sphgeom-30.0.8rc1-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.8rc1-cp314-cp314-macosx_11_0_arm64.whl (601.9 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc1-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.8rc1-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.8rc1-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.8rc1-cp313-cp313-macosx_11_0_arm64.whl (600.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc1-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.8rc1-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.8rc1-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.8rc1-cp312-cp312-macosx_11_0_arm64.whl (600.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc1-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.8rc1-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.8rc1-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.8rc1-cp311-cp311-macosx_11_0_arm64.whl (594.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc1-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.8rc1.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.8rc1.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.8rc1.tar.gz
Algorithm Hash digest
SHA256 132f0d84e2cf286f8e2ff5ac9cb742faaa2396e4431a8550fdc13c92234149cd
MD5 188de7498549d4f786fc0ebbed3268a2
BLAKE2b-256 7715a9e22afc812b716087ac2b38147f193b99c0080a241ab83217c3f7d9b4fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d7c4abf3511fdf345bc671ce40681c2dd073c875e72ba07c880b98f124a25d2
MD5 7d1aa3d48e35dbc21a5c5da9b9b941b6
BLAKE2b-256 320962a7b796eeeae884ae3e9de07c17e3de954739002ed20228220ee57ebeea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8268a02674982e247187bde7a8ada6269e1a1bcad47a116f0493690c74b56b42
MD5 5e14318dd9c90423d03d52ba0113593c
BLAKE2b-256 b130d1bd7c0d1e28aa1ec7a788972e923b3f1501a78f4ae96dc50c18a4fb347c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 40a61d1fbe3f96f912f1bdffd3ca29ea13a3229fbce20a099e70fddf98e09b7e
MD5 aa6a931cf0165700ea68e90ebca1762d
BLAKE2b-256 486e3f0645d19e73f2acf83ee77d5a9583d399fd7af5457cfb8e92ec9c5f0a78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 56960a821d114c08ce1549bfaacd0cd0a96a54faf8075fbb033f3c8f98ee0fa3
MD5 f0cd12ce8f9a1066e775d232a4c350b5
BLAKE2b-256 d4d1988d37829fb5a722dbb6e6a029e364d9752a54de1b94f5e89cd328870ea9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4c40b63fe2e503e9c4f7eab8ef0020341f0cb84f171a04334b54001548189b56
MD5 d785f96929576fce8679807e2f8216de
BLAKE2b-256 7db60503d38d9065b0f57f6fd1606edcbbd5f642593c30ce2f965fc740c3cdd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5814e01043ec20e39c54e1a081628facfcc572fb8fd8ffab182dff7ab2dd8cd8
MD5 1a0f4e471a5e58ff8c55d6d58f82ed00
BLAKE2b-256 3315cc36d0be8911e97b38e17d76bcf2e8e40e48dd78f61c711d73ff1142bd96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 30db97fa7e7612eb15416d07f68c7935cb93870bf21174caa0fde1770f9a1e92
MD5 663bd3eb09d6772fc2ae9a286e102280
BLAKE2b-256 2ca01e58835f065557a2d706c51cc1edfed1e3e65e9110baf632b60b317f3955

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 bd863019d77fecc2313cda6465bf5b4a2d9c10a75369ff9ed30e5e17e9d677a8
MD5 76b502de6879042def2f22c2fa7a1559
BLAKE2b-256 4638e10f8aa5c73b5ad70423f5f8e1aa27a6c1f999e60c80625eec3f524d839d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9ff5ba9362441fe7e6cce417e369310e6f7c9f968b22ab0e20e03a3683d45b9d
MD5 dd93e4b6d07df0d77f0f91a13b29945f
BLAKE2b-256 9775aa6f27bb12e36111cc7d13aa83616d11172ae233e8ffb440157c95f7cb49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7b9106fc4faba5734abfb6c0e52e5e8e7fc9a8bf2c17ecd0c46d44e8e309a35d
MD5 33dfbf0787b89c4b885c58f235649dfc
BLAKE2b-256 5cbe4cfef4a95b62849c8d0a894b2296f77122075cbe5de70303fb9bd6daf815

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8e433e37acccf1b3b4c0ffda786a3636aab518df41bf58d0cba0073fa260553
MD5 e112f5fe6d7ece3713c4cd024148dd99
BLAKE2b-256 65c53bd15695d8036f6cc6c3e9f862943e5a70f5fac836b821a8bb4909c17262

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ab617a615dd0eff2fe955cfd91d4935eef4925a81bae021dd963d6e6b0e6ce14
MD5 e38921fddfdc30257a8fb390579d8b11
BLAKE2b-256 0ada3d3c98b39754bf0b6726f2712184709f1480888b6650260b8cff17d60a8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0b7c2a34ebaa4122e8f63fbfe880ab2db062795544beeb2d35697c1dec0d43b6
MD5 a52ad86af1df5d172a505fac7cac41d1
BLAKE2b-256 92fb8cd1b21f93aa080778711acd51913084cc43a4dc460ea2abc323bd4aa8ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f99c5448294eb0e7d5bf7b297cb74730da2f0482d7abbd7e16a03215314d4b6a
MD5 ecd644dbeba6c5b394f2331b0b61e942
BLAKE2b-256 9f392d6954a8ed13ea3f1572af59ce3c87b2739eb7e7218c19d7af8a14ae5301

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80dfcd44dad31d2161af5a89e00e780c031e010736b6ea5511092a886a7f09a5
MD5 c528d9cd8886f5ec3a45e96f05cf821f
BLAKE2b-256 058bbd0488c59ab8385035862be780a1733f1404be69f3f83391312965feb10b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06d0653e8bf2303d1fc7dc9df224fe20d4d57cbb554a280bbf7e00cb9e840d5f
MD5 001cb6525723c712de0abf82519d5622
BLAKE2b-256 cd64e0ad03f780e34b39073a649eadefe5d7ef587cddef32fe74dad991f67bdb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8f7333f8086d395c700933dfe44f729a4b591ef3dd99de726fb3e7af3743c6c0
MD5 4af27a8281dacbc6dab92531204489cd
BLAKE2b-256 8e1a8b6cc981305ceaa34eb8ec8695b026aab47ad4eb23c4796c8e1f8f428784

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 24682f5b9256b98a6c0219f08d3a4a344811a1ea0e09e05c70375454b8ca2d4f
MD5 3e4a1527fdbda350cf2e402b1ab5210b
BLAKE2b-256 43235cfaa451b2f731d8bff3cf2b6b966ede886fcb1ff4eb77262f321674041f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1bbae5447b98c0dd3f2939b2e8dafd8c85e26d40fef278cfb8d50953c20f429
MD5 1c80e01284b30dc6c7953a9117e14719
BLAKE2b-256 bd8485d6e1de6c735f1c6fe404b0ec2d849988e01fbb4ccaa42fd3ff699e2a7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f81e557b4a79b90c07dc2235adfbf3b417c7a6a23a9f90872235272b3c211d20
MD5 6973b6fc187d5e78833f76324a86dcac
BLAKE2b-256 348ac35ff9fce2f45ee8332762738ae1e86b727e3e9bdb9cc4450984d9b48093

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