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.0rc3.tar.gz (129.2 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.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (660.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0rc3-cp310-cp310-macosx_11_0_arm64.whl (492.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.0.0rc3-cp310-cp310-macosx_10_9_x86_64.whl (513.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-25.0.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (662.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0rc3-cp39-cp39-macosx_11_0_arm64.whl (492.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.0.0rc3-cp39-cp39-macosx_10_9_x86_64.whl (513.6 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-25.0.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (654.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0rc3-cp38-cp38-macosx_11_0_arm64.whl (491.8 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.0.0rc3-cp38-cp38-macosx_10_9_x86_64.whl (513.4 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for lsst-sphgeom-25.0.0rc3.tar.gz
Algorithm Hash digest
SHA256 90955492aa319c88720210011f706a0adbf5fb7fc5a8b41276074f6e64d105f1
MD5 c8ac8e8f29074ba2bf44f99fab17cc3e
BLAKE2b-256 e7b751f7086280f95bb7095fe042c55dad14f01d4d7cdf969635e01891b52f0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcd1d6d8ea884775a51123986eeeb4e16e926f7b39b117f5fdcfa9987cea21a3
MD5 5a541ac67310c3ec9e63ccaab555e5a0
BLAKE2b-256 2679b61e17cab3fb1ca2bff7b39e7c223f8b8406627c30db4c203ebe01547e33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f415c3fa3ebac4c563f1e83fbc84ad0d3ac10bbb2a2902d5c45b5baf468f1ce
MD5 4a5666f0326694246c433f908fd5813e
BLAKE2b-256 c6ea5677e04579ebf60a894506a6f3d54b4eb62e24353680576e470e268d05f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4f72fef58badd1753d1db407d05392b8d780e5626f90c27d85a9b7dc1492ce04
MD5 2d55040c54e4a20d3856a305c65e65b5
BLAKE2b-256 bbb7332ff91fe7949e27ac1b110ab19539f55c7281038bb92a85ea11538dd279

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 34d16d31c9e71ff42191277be7d0133b31a7bc6479c29fd5259c8ee21e9e95ae
MD5 740ca8552a82d08018fd299a5014e0eb
BLAKE2b-256 497c53157da7b87b2524a41790595e2656ad54b99b749a16506762ec975c1ef2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 106036cead485a09c89f11febe0d07e5aaabb35191941bca9e09ed62e5b9aa58
MD5 7bb85693540c30c3391e22ec3f2f10e8
BLAKE2b-256 d8b803d5bf83743df9f7695204d277586ce38a43dd1282aba3d314a12ac25f96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb009de018d7c23e76264c526e75e2e3f193d7b9afef1339b3212ff9ffb7a322
MD5 6c7ecceddb89e07d1ef85feb7fa6e71c
BLAKE2b-256 56d8c2b46d40663d79d6c5c7d8d227a387613673e7aaf705fb38648006f76f73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4446c56cde88fc61c99f291677c6ad22b1b5d6f5a92f83e36f50cb6cca6a62b1
MD5 077417738c66fdf733deeddd4f89bb18
BLAKE2b-256 12feb06ca8295949142c8cd5d66c9855e5aed6e927feeb635a08f38201df4f00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5dd6fa0e10baa78240d0ea3854370cd3e31065ac1255a40166dec8d217d8f78e
MD5 c6516b5fdc3434be5f61284416af7fc4
BLAKE2b-256 5967b46b35bb7f5cc0d82c42f30c87cfbf1fdd51ff7953e00fc93d37abbee189

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0rc3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 67b653d32cf22d640e1cbbd9af8876ecaad0e7260cb9406c20e5880276138041
MD5 f772bde05813ada30187e73f7c998eef
BLAKE2b-256 7c0ba08b5701d858e8a6b715d508e0159f6c628ddb6872adbd15a99b950cd757

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