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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

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

File hashes

Hashes for lsst-sphgeom-25.0.0a20223600.tar.gz
Algorithm Hash digest
SHA256 3e762f7674a71ac5e41d677f5fd9b795c7ff49c8f29a27d869efa125a02ba0be
MD5 86bf160ed81605ef3bc262c17327eaec
BLAKE2b-256 e90e88059054e32837a4c094a751807a5a0409c58f1ecec0a28dde3f5e1e8ae9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7317bb2abe832ecbbeb8fb7b637f5e4526fe8c3f8cf6652bf8b4417f8c077e82
MD5 d8ac5bd867046a9ca165868baf18d8c3
BLAKE2b-256 17e2d3fd8ff7185fd961d173ba998dc89bfcb7a878d86790622dcac4fda96a56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8cd692efc72dfcf8ca4d80845ea5a5a55e6cef564760fa2146a9a571d42884d1
MD5 0930eec8600dd1a60e2a715b881fc428
BLAKE2b-256 ebe90309bf0a46b2fad160936bd489b78a3a91deed2e92683a98391cda4cad7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0b175072565eb0db3cf02478637704bca2930363554a61de4a85b66d9934481c
MD5 3f4472c21ad7591eb8ed3d73de28d74c
BLAKE2b-256 c5ef3c2b0169d1031cba6dfcf675ba78fa38e20458b102ea0ea8f2a1c10e89ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f14b30a4581131e1e468088f0341900a4d09716f78dc2bd62b3861ad3dee3fad
MD5 1d567698490d4d566c3bab0eb4cbd405
BLAKE2b-256 6d9c1c67a4760a296decea1d29b61311a063f6065d0a0889815e336218ebc040

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff989a0f4eb00cf701abbdb2f45d215004445e7160f5db471009dca6c8c6c93d
MD5 9f1fde0beea2f7fa2afb447521057919
BLAKE2b-256 c0e0e2cb2082da3eb715c1928de66c7906543e4b4bc2d36269ec49785892c38e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3f61ddd588c0b17183749692faa3c473d205099fdcbdd2bdd359c02948379233
MD5 54ae088b9ea8ceefafeb8f089718984d
BLAKE2b-256 c38ef6faffed2821e7e3a2dae2a0f8a5fbe3e845f5f69fea5b3d3691f515998a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4e403ba7a4cd5218fbed0c838eb1d15bad50f68b031cb8ebaa59620200b3290
MD5 d613358c94433e7f2c82c41508a8176f
BLAKE2b-256 dd59846ab063917db46eba8c9b9ad50c51f25fdd12b4a59a44de5572b3df93a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 045e8c87ec7364bd394d288bcb792c3e3d177819207415e6390d9b8490436b0b
MD5 11473d9abd4e0238e91891c1a66e6d64
BLAKE2b-256 7210a42f596dfa70126b528e0addbe23c3d8c685f8d26878ca13da064257cf85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223600-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4f8db5ab5f95dc605460f875dd6c337a362a940a776827d8885ae7c23714989c
MD5 8921b0368d0e243948bb680057f40acb
BLAKE2b-256 938fdb8277b0d8866dc5b4a67c258c42a7c69b30ed9ac072e3229878445319bb

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