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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20223700.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.0a20223700.tar.gz
Algorithm Hash digest
SHA256 86217c8df6251dc613d824aa5c10e6b7a0cab92ea5f767674b498b67b605ca11
MD5 a2d8ac87317c7f865f7dedbf500c43de
BLAKE2b-256 62ceb92ab648254fc3f127e6de7d0c49c67719fcc9c95274ce5257ee8acfeee0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aeaa3e1d3f6e9328e3c58e1384c622a1f59528cd9d640bf4950c0688cb6e0f54
MD5 1f7a73c749883f8f3ee53ec9573e6dd7
BLAKE2b-256 569c3719c8a04aeb53588aef4a24c4d33156646f6bede47dcba9558d67894a1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6cebe01da5db6085b047aefaddce9ba3a0d93f7d8b231cb7a948be025c091e8
MD5 0ea70152d49d0ecc619f330ad122bf4f
BLAKE2b-256 d86f3ea8f6e0febfcfff16637ea03154ba7afcd4fc6a62b832bf198d9a14268a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f8f1f0be62ed38e323ae178ec18cdd186108d80daef5eaa89ad1d063644966c9
MD5 deb2d45e3cde503e15f22b3fa905bb03
BLAKE2b-256 cfa5fe8751bbf81c8306a84fad1e9c85dafe70052853eb371b3aad8ed42ad7cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54b305cf9755efceade444c8bf5a7034379b7c86d1235e43452beadd0ac1ecbd
MD5 1dd9498e6afa7b37f87ba6dd2674d1a6
BLAKE2b-256 9f7a452e4c4346bc33a8471719105b68d2b61ec2cffddb448357286df0b34a40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1b7b44448ab779b919d5f2b2da1b386edf4dd2200dfbb487b9cde59bd5cf218
MD5 7ee72ab165e11aed284d7cc023da2d8d
BLAKE2b-256 ad8cc4d17ca6f2bfb268cbc7a3941b286fcd99bed203243506cbfa9494b42a16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 706ea86fb890834f84d673ad6662d5ae62494b203fa839e026b7d9c2e68f78f1
MD5 bd1c30c18434d49d1c84d94be454fb33
BLAKE2b-256 87bf98cdc75458c75d49a7068fbac7b052c011c14b569c12237d5543251ba846

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8fd15b4f569e8874aed0129e6fbbb0dcded74a5c87816ad89260356218a08beb
MD5 cbc4902ad880075827adae67e07c6de9
BLAKE2b-256 1c17b18d4c93d1f34a11112f375bb79873ddcf367be341f72af8e1c35165f0ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79cc3677f2546ee4a96d21b2b2a2b7d9d19d9b4583aaaca90cd98d9868d329d2
MD5 9cd218f006dfdfe11c6efc6f2b211e96
BLAKE2b-256 acce95fb0c6da2edd5318526f5869aa8fc53d630c56da38a02a7cf8d69ab9ce8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223700-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ccbc84996236d72fbc221abb19dcd8930da429584dd6fcdbc348253311f1604a
MD5 9b1a597d15d1b5e3c0fac4efeba8dfed
BLAKE2b-256 49784db91f577526ad741c725df913aa35f7cd1c1f420f5ed5ba49feb3f5254b

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