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-26.2023.5000.tar.gz (141.4 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-26.2023.5000-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (692.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.2023.5000-cp312-cp312-macosx_11_0_arm64.whl (512.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-26.2023.5000-cp312-cp312-macosx_10_9_x86_64.whl (546.9 kB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

lsst_sphgeom-26.2023.5000-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (697.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.2023.5000-cp311-cp311-macosx_11_0_arm64.whl (507.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-26.2023.5000-cp311-cp311-macosx_10_9_x86_64.whl (528.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-26.2023.5000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (693.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.2023.5000-cp310-cp310-macosx_11_0_arm64.whl (505.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-26.2023.5000-cp310-cp310-macosx_10_9_x86_64.whl (527.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-26.2023.5000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (701.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.2023.5000-cp39-cp39-macosx_11_0_arm64.whl (506.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-26.2023.5000-cp39-cp39-macosx_10_9_x86_64.whl (527.3 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-26.2023.5000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (692.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.2023.5000-cp38-cp38-macosx_11_0_arm64.whl (505.7 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-26.2023.5000-cp38-cp38-macosx_10_9_x86_64.whl (527.1 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-26.2023.5000.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-26.2023.5000.tar.gz
  • Upload date:
  • Size: 141.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for lsst-sphgeom-26.2023.5000.tar.gz
Algorithm Hash digest
SHA256 edff1a3d98d1eaeac94da80e71a8835c6d70c50fabaea1aa23e8757744fb6da7
MD5 1b3a9c3e56c0bc73a836c67073e6f1d1
BLAKE2b-256 fdb08d917a7a06d9036f56c6e0d933d201a48bce28cff48f9100b39ff3f9761b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 135815fe5160b6c9d2e576178ab7634dc4d9af446b81523cc4fab9f5ca34f5b0
MD5 61788d392620b7a802b99febcd30cdc6
BLAKE2b-256 f47e5ac9944b0f8820d3e05fba4dc93eb1e0a2c2f55e311c0aa349a17ef40f71

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5127a66ee10a853688c83f8d091d2016fcf75f1d3d88972c93b9eef0f09de855
MD5 bcc4f0e90cb81de11bacbc87b4b6f638
BLAKE2b-256 44b3fedf194892da331e8eb21e73f63d52b890b2867b5fe9a4f8f7e762415775

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 05b54d1a32cab09d64dde30f82947a46f31b5e8991d5ad947e19c218c4c7d5a9
MD5 890359529a081aa68ee152012dc6b52e
BLAKE2b-256 f0b8c2c1a2fd4490b31e3d201743889f6ec6ebbb2ae03245b19fc732b5c45aa8

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 704d4079aad904f2d14b30aff27a0aff6fa9cb18cc951d20d26a49583b119fb7
MD5 cbe36f5cb057839662f78c3e8885581a
BLAKE2b-256 e1c3ced42abb5907940ce40744529283c3e44bf12867e45adb69553fecb75d86

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65246a04c2df10026eff259d232b123d2cd916bd4bcf0daefd84efa76525a0ee
MD5 be023b9e86fdb0eabd9c8f2a52f058f4
BLAKE2b-256 c1c47949e1ff28fba878e5ff69c93341b5337a5e1e73e865277b016ed24af4cb

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2da768d70ac75cc1930729bb0508b6d9059c10cfe85fb2c67e007aca01da20e5
MD5 366ca2ff8d997d2b8f4ff11719f93347
BLAKE2b-256 707667d24b9a2dab299e38d3ba54b24b6d41330d77c085e8358dc4b4afb3a6ec

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 174a1c50c596eb09705e42ac68c5c238e24abfac31c47ffed7cb313f51541c80
MD5 b07bd3fa0868874a0bb54511bcc212fe
BLAKE2b-256 b5788b3f0cf919def3b1f90ab0dea306940773926e40e80043d56b94615bf848

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2de47a8dbd967d4147b6fc1a7ca2cf18922d025a486b8555219f1c5c88a3932
MD5 3fb3d4d7fc5d1a818ad9a4b04aabc4b7
BLAKE2b-256 1eefbd88f904d6747f3c93e3249b04610996bf78fc7d34e8db7237f07dfd4fe0

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 11012573ad3b541d4f602c84cc4b4a89ecb7f7140df32ee2084167aff598046f
MD5 ad4c41ff3fc39e4d2f6e90aa6a1b17db
BLAKE2b-256 b690bbefd754c604f8abec39caf38fb4cb36e2aee411c090a9e0b48c0945b317

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96e50f8e20bfd62a14e3e0636003dcfd3d4e81272a91f7393afd776c6c667ade
MD5 8161a50219213c2503aba3ff2b83b094
BLAKE2b-256 6ddd13f9d0aba0e6bca37c713277b45e16f0f3acf00cfc09704b49593763de4d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50f964cc2068f1c404cc961e22a4b22670c9782a0b95ce60c37c7d3942a08dd6
MD5 8193539d25542b5146193094788670c8
BLAKE2b-256 3117c44a9d60aec6c88b2b8df0d180d8b581566886155f4a0d8410025dd81e13

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9db7009af1643c5a6b4f76a676e849190e964b1c55f808460f64af270e156b89
MD5 43aa1fadf7fe104f94eb60fb63ceda45
BLAKE2b-256 07a4e1015ca3bf2dfe5554b140fdb143417d6890687efa7f6620e55b3da79eaa

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 00f3578a4ced826d0e7e93727817a722356e74d03c37dd91986207b0e8f333b3
MD5 290920f9c5462d084dddfbdc44ab65d3
BLAKE2b-256 03c97bd3a95d1e11522ed1e7aa3021f973a552071ba73ecafa0cea8e8dbc47cf

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6de1738524754ea7d9509fd05b9ce03a95c87bb7fe25b44bd7d1c5546ef8aa0d
MD5 48553a627dbcb228d0028211610bc142
BLAKE2b-256 d3e2c1d2463c78b70d004e364d5c911fed3f1982e205d62bf189a62546584074

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.2023.5000-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.2023.5000-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eae4c57246e7ecb8686dc128a7278011bfce26866be3bbc21fe23baa597ef504
MD5 a9aa4593ae6cb779cf3f9b743730277a
BLAKE2b-256 d14661793440b52a5809063591f6bc1bdcfdff60b8231d8b7bfc04141429d334

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