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.0a20224100.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.0a20224100-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224100.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.0a20224100.tar.gz
Algorithm Hash digest
SHA256 5bf5b272678b4431a2eca0647a085d344444d9f7dbd6ff717829193d2e34bdcb
MD5 2ee498f32b6568fd40e308ebb5acf541
BLAKE2b-256 85a8b540869d8cf664aeaa18d2d662936e1defe4eb6e62cdaca1857b66e2f00c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3079706749b913ba83a61c2954acb532b97af8beb215988d774744ffe2ef9392
MD5 d5d9704c730723d90211961d33bf7f25
BLAKE2b-256 96da940d365467d1223f148f92435aeabf8f4b9596b6c87335e05319d2c5d84f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b0144fcc7a396a3a995b05aeaa617b09f5427aaad5908b0e24c81bf4980204d
MD5 6059335a086d71f3227f9f1b069c046c
BLAKE2b-256 4e52e0d926b537df03e5ba680a26c995a6e5e06470d8f464419eba1ca51ba723

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7c81adaafc4cac2d4ce08a92c03fdce1133e55febf241f39a7354a48335b65fd
MD5 0530a9eaa8f523b716e42fc3aea2293c
BLAKE2b-256 8669f979cca7bfb8047d71df7e39579dc6a40e55126aeba4ee356f6a3e7ec9c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f44f63c711d20fcf575f870ae85b9d8179abe8c3dd8e630952fe592d2f463331
MD5 f3ecec8b2e8c375653f02f223fc36df8
BLAKE2b-256 522dddb8409fcb430f9689f11c6c5c012996274a1267212c9ef8c5a98dd1ed00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 822798932a134612920b8a5039b068117cbe89cbadfd7d0060dfb87747e9e99d
MD5 cbdd12974a58f4803251444db55dd85e
BLAKE2b-256 e4781268f95b8c5a57c1a23d94570afc7381b861929f41dfba98b4f5ac73efcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3f099c0d0ba8296d1175352643e4a24366b16576473dff819ae76e729bc162e6
MD5 0224ebea90c29ab5da144b4b5577a1a3
BLAKE2b-256 6ab185aa274b5294f23fb3782f90e1cb41fccd3d0a5a1ae370f23be134c38395

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9b5dd04c43bd619005b2105afd4dcb486dfb73356d8ed017de4a229e610fb76
MD5 463c8e625a2c005bc7f638a8dfd84d26
BLAKE2b-256 f098c2884d1bdc47c1919781e28962a14cb2c90f019c65c3b76a0ec8ee934efc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4107e2b58d642375d8aaa24b36dc109544c8515e0c9b3e046f795b6faa75ac98
MD5 e4c8cda7334f0cc68a0ca688b8819e34
BLAKE2b-256 614b5bdc8351abbca00c829a9e3d4d76ee1276597532f64ff22c8c98b16c1ad6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224100-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5cf9b2c20d37a4f5038a57bfaea625d1c0c4f66cbdcffa9703358f8852f910a9
MD5 59b4f1249cec670bb5085c9544fea25c
BLAKE2b-256 f6c3b5e06c7ff4f0b6154585d06813356a5d38b23ca9b8a4a7f4fd714dc89832

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