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-25.0.0a20223800.tar.gz (129.3 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-25.0.0a20223800-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20223800-cp310-cp310-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20223800-cp310-cp310-macosx_10_9_x86_64.whl (516.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20223800-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (656.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20223800-cp39-cp39-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20223800-cp39-cp39-macosx_10_9_x86_64.whl (516.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20223800-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20223800-cp38-cp38-macosx_11_0_arm64.whl (495.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20223800-cp38-cp38-macosx_10_9_x86_64.whl (516.4 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-25.0.0a20223800.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20223800.tar.gz
  • Upload date:
  • Size: 129.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for lsst-sphgeom-25.0.0a20223800.tar.gz
Algorithm Hash digest
SHA256 2a83d1877806d0250bfd8850671996a082b04347b3e6a5378befcdc6bd9f850d
MD5 50e888e32b666161b90886b3c51ba4f5
BLAKE2b-256 793055b8c7b1e32484aafbd15fdbb411c1f5089dda1675e752b881269ea3535f

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c9f9d7c0d99cb809339744009e92169152d0e49fe3291927f8480f79cacd52fa
MD5 299593ccfc4cdbf57567a49447d656b3
BLAKE2b-256 9b99c9a958124317f94dffb4b56f1f67246afea32ee3c7c338c4492b77ef7283

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 419d6773c71c34752fe7eea488f94d418cafce8d595860d7023f3c88388f58d2
MD5 796eb9f384dd5a652ede7f3b3148266e
BLAKE2b-256 60569844bfe9bfa01e680f83e34189368cd401c847f1756936a42991cc1787ad

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b1f76ec92fa6327410f273c98962f738f72934c1552542650f2ed4cd97d3145b
MD5 7ebf50aaf91445ad5d83a8431900a46f
BLAKE2b-256 12126ff3fc4f2e34819f0b273907029e17a06a99e2c96e3eec1ab0d2c9ce4a3c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c850f3fd6c9cadb2728540e0e12a037d49bee16249209bc19a960f9a04727971
MD5 8f7e97b0e8b2e8cea1e6c213bccdd515
BLAKE2b-256 bdba9e178b8decc1c79ffeb4f290b708d86aea8c613e7fb15b09e2b515d0d08b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 098fb37770ca15a895c1e44e1fd41ca634ee6b9edf2f4ca95239222b5e75edc4
MD5 4f26d74c9c7bd7781f29a57ab90b5573
BLAKE2b-256 a830cf9b5d5811e35170ce4c5d814a9b19fbed76af1b6216c328a0dc78928271

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 725ce498e6da68fba8430f2b1cd80dfc451e7ed69d701cba414ff221f4e8d1c9
MD5 f23d4fd053d5c246e067f0f899fb016e
BLAKE2b-256 6342aa1364c851f90cc44c82da7e16d47cf97d3ec1922eb93b2800e70e0e2ccd

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf24cb339ed0d4acab89bcb6917b6edc7e8f811f0a04b91dc5dd43388a81ef3a
MD5 ca709d31287c935c058c41c365c3f2a1
BLAKE2b-256 5b8093bcd8640f24218a8da264a4695e7819be8d7ca8ae06fccb3a5949da752e

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 986692100b106db34e9e033b967e9c22f2041bd1d5f7cfbcfce773ad89d04a2e
MD5 3a12d77dfa2d4de46577523a53a9bc73
BLAKE2b-256 daa4b0d0dce65ab24707aa0784def461672b510a9a25354f4222499c3ad9247f

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223800-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223800-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ee77d9f8c9e8f3446874b20b6e1084e4d6b35216340a090c54c5815ff333fef1
MD5 078bdaa6ce8defc216214b414532bdfa
BLAKE2b-256 9d4d51b7180327faf982f6867c193094817cb45978c9f7fe204d71a8253d2fa1

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