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.0a20224000.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.0a20224000-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.0a20224000-cp310-cp310-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224000-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.0a20224000-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.0a20224000-cp39-cp39-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224000-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.0a20224000-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.0a20224000-cp38-cp38-macosx_11_0_arm64.whl (495.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224000-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.0a20224000.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224000.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.0a20224000.tar.gz
Algorithm Hash digest
SHA256 83bb794ddef1df13a7ddae1ccb730d9b2796c37ba1b91991c59d07a984822bcd
MD5 fe898e02061feda1a2cdb380fdd25b3d
BLAKE2b-256 a030a1e36001f42a3aaca150efa984e2fd57f10af6bf8a6b2fdd9bc48a3a056f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4548259f28b30ff285d0a0730b0c5594f1bb47fb35fd4baa950c72da5b5c0cef
MD5 40b67bf09d3d4cafd06ffffdbe0a7acd
BLAKE2b-256 149382b47ecd055826cbb06c1999cd2523ca61c4f0cc8178e70cc4d83687c866

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10fb38c1bb13541e2db4a91e133463104ab6866a10a3e010af9a44c2c8adb9e3
MD5 d3c93db26d7d38f47cc75ee8fc563206
BLAKE2b-256 107ed302b933ad4ce3bc97ec4134bb3c21fd5f1c9ee6b2a3cc8e14e52c3744fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 17b0ad26adf5397a213cf06075023c0cb8999e567c1ca15c7e0a90363c3e40a2
MD5 0b8b8f0749572b73ce6a42348b07b259
BLAKE2b-256 74d5901d3f639c4bf251372f8afcaf797b7d303761d5bba42a1a01eb0a200caa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce05cbbd0df785557e181e85a14b7c54f1bea1f8388107a8b5778215e1d7f2ca
MD5 c445b1cd4759bf8093dc9eac49e00701
BLAKE2b-256 95635e606d2d3e13f5958465f2edaa4907809e1080ac2ec7d0f02b3695b29cde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6601448318694bab1ba600e310375f970dacca717a2fdaaf284f39df52546a4f
MD5 e41278636d6913640d298a606d7b3f8e
BLAKE2b-256 ad3d30cd7f6963a1853c60156df513f541202964bdb7ba9508fdaef225c6eef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 79f94eeb799be9aad8374d78a72700ce25fefa5bee461be36b86948bcd342cb1
MD5 9f5408d59f460ba27f56f646656c81a4
BLAKE2b-256 8707a804ec0b485c10dce738da0e3ef40538bc3ece70ba9091f1c7dd66e35c14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23ddf00a00a2885339cb34442659f699e619732fe36b54663d79b19cf79595d3
MD5 6c07d54ca6633bba642910e465ad65ad
BLAKE2b-256 557d620a82bd8ac25c68c044543213f2e24abe61fe4cbd0f61682d1182739e0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e61f6cb16b19dcaa39f1243d9b16d4540a12241758cc3ba91587050447a044b
MD5 9f731e18f28e9b7e5feb2b0bb7cefff0
BLAKE2b-256 bce497ba2046a3d5f07c4989f8d1b64737043b74fad38f5d62dbed86ec50c5c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224000-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1daa2c8f8fb8ac3e6f44a1e5af3e1a6e13515a192d5c8a2a7660a9a7af76640c
MD5 3ac8aae00a05004fa38bf363d3b076f9
BLAKE2b-256 c65df32d5a4fb113018d8d1c3c512dae250b2fa687e44447be393c39cd1ae53a

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