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.6rc3.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.6rc3-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.0.6rc3-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.6rc3-cp314-cp314-macosx_11_0_arm64.whl (602.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc3-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.6rc3-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.6rc3-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.6rc3-cp313-cp313-macosx_11_0_arm64.whl (600.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst_sphgeom-30.0.6rc3.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.6rc3.tar.gz
Algorithm Hash digest
SHA256 7c465bd234b9b133bc431f3c953beff1af674f88a846c9b5a704927a3f2c2d18
MD5 d385aff5e18a29fe18a577669ad10f30
BLAKE2b-256 f6b29206bc1a5537d38dd02d1cb29c11f68ffe83f45578aba7bed225abbcc883

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 934e705e268fbe60fd085b18335d4b2420491c5e418906b3dc3ecbf185d1ecb0
MD5 affd7ca848f73dff40756185dbb5708f
BLAKE2b-256 a254967f942ace99422b9cfe4237378783f05cba14b06e14942f1ec3b0dbd725

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b69da831c1477f9ad9a5b693775343ea5aa9ea0827cbc6ecd78f6245ac4917eb
MD5 870c095e7057dae1fc7f879d92c9a274
BLAKE2b-256 66e5c35c918790fa6f360fd161522a1ba83a386e843097571e8c7d397c86270a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f542ad4433d7ccd0ee3a5786b8a04b74c63ebb8696582b96278677bff95d15a
MD5 077bd20360dc19fbcb9f694559b09d23
BLAKE2b-256 96440085995c515102cd2ff0c7abc26652358b1e50dcefa864b55002d3fd08d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f8b29e33bc202a8727eb991b920c2e0524166749d6a31d15abde768749860eeb
MD5 93499f7ee438bd1414db7b1ce8ac0cab
BLAKE2b-256 146c4e86c13b8e1b1db7c4316ddb2ee893702fa1fcd4fd9a7e79d78448be6725

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e32029fcfdb0e968b52ce7bbc2f2b68ea2a6eb0f5b70a843df9bbe14249c16a1
MD5 d059bb5f3484f0d789a166d630ade2d3
BLAKE2b-256 c908d5765fc2c737e5eda7aefef6549a2ef7e2c175c02b66289d11f1ccd7eb3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7afd92ebc1b44564d4432b9ff833a6b68fb6482e54fed0f59c7479dd4039dcd4
MD5 fe40aa42bfdc0811b479310405631b93
BLAKE2b-256 7a8fc0a3e89bef72d691c790b8a215ca2fbf4b5caab8f9fe8eedeed092c07b30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ad4ea1aa0f6fb7cc89cde2c14a3e3ca7cbd3ba1bd2d9293e1cda9a9bb752882
MD5 b336554bd7b7e6fddfd0fc6a3dc65c50
BLAKE2b-256 4ef0e66f488fb456977c25471a9835a64bd3ae8f768e06ee93d7936d2275b7cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 008ab02cf9addb278be1c4c99bc7d07e0d6216a13a02b3822f62e0019e4fc26e
MD5 4bf13bcb1440488c39b7964ffc703701
BLAKE2b-256 d7e877a6d70586dacb5c89a6f0c7ccacd1922d51621e81110252f0d1b5b4c91c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6fc7827da570a8ed9a28f258a9fc2e16819db7db1de052f24155802f401a4af0
MD5 07b02d9d8736c54c8c935d8a13a640aa
BLAKE2b-256 19d0d05f4a11ff589fd858fd275d6889bc8c76446df41a59b15f0e6a239f170e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f644b07cc027f3336da817314a63f29816f158dd3db4143c681f5315a08c68bc
MD5 97ff16cb26f65103c5f80215e45d26ad
BLAKE2b-256 170ec68f2e47a1d226c2db8f3acb82a1efb9923a8ab99df9a82980abab2a1a40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e706a896d1727a526273f0e74c127a66daf78c5ba0f36eff1dceed1d68213812
MD5 c35fd64b6597757bc4c08cce122eb507
BLAKE2b-256 4072a45a82557cf31cae634d7558ad826ac3fb9568ebf376d3fa363272990bd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 38b4d843d12c0971d29444d97f25fefe1fd19dfce262dfd434aad03acf4f7833
MD5 17a6e1bd14ad10ffcc518bda7d1d7c15
BLAKE2b-256 0bec19c9bc5ec20bd2b664604801804b86aeeb3b9eb43d013427cb566792bcff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0b5238dbb2a55c4377f8d111fe6e9fe252033db64b46a94c1771a972f5d22395
MD5 9fac3f271de5f0756e744d20e727236a
BLAKE2b-256 59398489caf58506d377b5194b448d5554c903b4d78539019515316b3dd87834

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dffe0d7893d8a75117e246cb32f8e6373bc64d049c25ce91251ed72b4d12543f
MD5 c0496ac18a53b0e4f3b133953e81e630
BLAKE2b-256 bb0ececccf74e0331ac633a6bd672f2f42251444be03f27995f1a0b720c7460e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b1412b6440898fc0bc550afb47740e9f6413d1ce3c8745f5ba5472d9cf7ab47e
MD5 374c3ac837ed1ea567222c4db3af4716
BLAKE2b-256 c86ea587d2a3da4b25ec7bbb3d415e28f0249cf4eaeeea6fa8e8064a9b7031d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b37b8d3de86c7f3693caac8b75397f59366c6da38d424061132853ee1e4d8b1
MD5 fd418eb0c40dc1260860d7c8dc17ea34
BLAKE2b-256 5ab6e5b974a05cce5da10f825a6e45951522042765e65b9ee9f805d63988e250

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 95863b3f428f4e638a03f3a6bdf31ed3c406b5b4ba8f0aa890b25fa55ee36dfb
MD5 9b38088f02dcfdcd1d5218ca86bd8fde
BLAKE2b-256 0bee6d0199e3247dde55dc2a52af8267384ec331f1218150c729c390d840ea94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 42e1b7d331f9b7b65bd4ab8a47ee3ffed06e12747a0ba0a6d0921c1ed3ffdbed
MD5 f9568f4688e873ea43614836dfb37423
BLAKE2b-256 52c3c499ef852728ed192f41185b9e8e86945e186300ad8ca66655c4981725d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4542b8f232550c3d011e9407a9a50afc75b51238efa965a4e73335ef0b2b081
MD5 375e307f9541b0904c145ea867768484
BLAKE2b-256 091fa56b463e7fa0c3e138f9bb761766159b899f61a7f32b7443a1e138784c7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f439a4fb40d14d417014913ab96c4b39f323947d8ae9626952c4c30dadc44d0b
MD5 478b0e72903405a2724b2691c34be8b1
BLAKE2b-256 e2bef7084d79b8ae01bcfa9b1bd4569d0c3bfe8d352b2f488b1e1dca363f91de

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