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-30.0.6rc4.tar.gz (162.8 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-30.0.6rc4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.6rc4-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.6rc4-cp314-cp314-macosx_11_0_arm64.whl (602.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc4-cp314-cp314-macosx_10_15_x86_64.whl (629.5 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.0.6rc4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.6rc4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.6rc4-cp313-cp313-macosx_11_0_arm64.whl (600.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc4-cp313-cp313-macosx_10_13_x86_64.whl (631.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.0.6rc4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.6rc4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.6rc4-cp312-cp312-macosx_11_0_arm64.whl (600.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc4-cp312-cp312-macosx_10_13_x86_64.whl (631.0 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lsst_sphgeom-30.0.6rc4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.6rc4-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.6rc4-cp311-cp311-macosx_11_0_arm64.whl (594.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc4-cp311-cp311-macosx_10_9_x86_64.whl (618.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.0.6rc4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.6rc4-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.6rc4-cp310-cp310-macosx_11_0_arm64.whl (593.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc4-cp310-cp310-macosx_10_9_x86_64.whl (616.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file lsst_sphgeom-30.0.6rc4.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.6rc4.tar.gz
  • Upload date:
  • Size: 162.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lsst_sphgeom-30.0.6rc4.tar.gz
Algorithm Hash digest
SHA256 afd2df5869d16e0cc08328a441dfff2a2ce0c1da3473afb3242a31ca975d8ec5
MD5 8fe0d163c3ee97a261359a52489432bb
BLAKE2b-256 ba27fd84e5e4fe71e4e4a103f24272f8870d1979556922607e5ec3c794e15394

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d681d58d34548c0a5744eabb706aaf9547b15a556258b19b8561d849088145f
MD5 ac66a2f36404f5d001ce8eadb9be6c3c
BLAKE2b-256 40b82e0d386798ab7290578df2800eddb5846093b964be00459bc0b4cbd55272

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8576591d63551981a9881cd86f845b905f7f43ba7e3e831e284551cddd9d1333
MD5 1732d508f2ba2ad3e0713ea1e07f5478
BLAKE2b-256 897615e7af7912fd10aa3ac0177c704d5349a2c77cd8c9c4a7d9414b902c9bbc

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c916ffb0dbced8d385fca73d3654631639475f071e56c25a785e074c51ce88ff
MD5 9a028a5878d7aa5986cf39278436108a
BLAKE2b-256 596349304b0f7b1d5d9e50ed60672f76eccdc445f8fcac82bb1b241d0620d174

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 7dbeffb51c6d125768705d375463ca148bf931f88dde32db156b101c6ef582d7
MD5 01f794372ec7c16d9262755c25aedb84
BLAKE2b-256 39905684caeab36cc1ce6a45f44d1aa0c49107aa286a71eca75c828b1f99bc60

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7d6993dfb99306fd38a8cdf4c80ceeca1ce6e1bccbb1da7240c9d28664b27f61
MD5 421c41130730dac99136f623e7e2e2f2
BLAKE2b-256 5c5a88b1571f178299d7f63c389d2c62de2dcd52345d40a808cd629a23706681

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1f21520f29295aedc2119bb9405693ccf27216fa26d17fa1cbb8af3b5649f0b6
MD5 e4a52aecc93ff9dd82661acdfde8c895
BLAKE2b-256 5c43e0dc89bace9dc03e9342aa432b27396b4cb3a63839b066b0718cfaa32b7f

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c94c2fc2abd81793bd36eb161b81a5091c3a07d4b9e7ac8e3cf77eab7e3fcbd0
MD5 4a8d00121de10edaf9ccc64b98765766
BLAKE2b-256 7908c57890ac02b672b9b835f463f8e7d4373e55a2344ecc4d179363bd872562

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6aedc20658e2406d287512e4709b78b75f28fe62261b3a6d61a81ec00a4ed4ab
MD5 68da30f1d9965b2ec24d73619d576693
BLAKE2b-256 f175b3595e1367452eba1405344d9b4881fdc7973baae9eb12ff58e5596b3624

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 59c4329c0e8be0139a87d3f3f7deefd528568b1b99c09f1bafd28c0fe73bef29
MD5 f830d249f3ce65cdd38d218cd84d5b9c
BLAKE2b-256 fa2f53c198103be83a565b0c93ef197e190935f00b88533c3b8ace3834241b57

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b793903e3a443997236fdf5cf95aca6136d11432d6bb72505f33bba1333d7823
MD5 94d4f0e78c219662fc402d53df898f9d
BLAKE2b-256 552de890ed2ec3f88aa8f60e1337c306668d9d65f2c352cbd0d87d3ed38c354e

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce5f550cd6069e07112977084b6b9881ccac11bac043bf11ed9836967596dc57
MD5 68df3db8f0e998fa93a8e86d39f8b53c
BLAKE2b-256 099cde7e7c8337776a5df583e628a08d718c189dabe3d3ed059f38e314f3d9a9

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 68429e65d4797f4348f5c9421deaf02ceb4b281aeed6ce62b283fde44d35fc71
MD5 6c82424498e36cf22fcf593594ed44ab
BLAKE2b-256 99dc671c74a929489c4dfbdebc0181c0373d1d2df451430a99936f9507ebd627

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c8a58468779be14ac27cb41af000edb5541c2ec1a5bf4aee12b997c6c51b293
MD5 bc05b110e7177b4c3195d129a38f80e9
BLAKE2b-256 fa037be4330b5f0c15eec697601f9b3a07a64ca484f042dcfb43d6c41b4152e1

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 04ae84395e378b862cb9fa778139b9fecd201b8c8b6dcaebf0a2df85721a979f
MD5 e47d445ea4566c32d22a0d36821dcfdc
BLAKE2b-256 66806b04f82e3387f18199ae81f41ff9abc2b072405730cdc232710b7c818d33

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92b455c021b80ff5dd61b60e8234b0133ae1c511fa0a02be0f42493e1a120b5b
MD5 b695c944a64291a94bf9d2391445b36a
BLAKE2b-256 1d4f97af2c25e70ea4f2e0c857196eaf592cb996f8f722d6ef77c9bbe4684717

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ef22616670782311dee4966a1175d171a3ed2ddad4a54031bcc1bf674f21d4ce
MD5 88b580aa9989926b727065de6af6078c
BLAKE2b-256 f5a06fb847d10463258a8bbedb55f2a9b45510c628b3a00233fbcfb5b2618961

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5285a1ab78e4db66c4a0be014d8f9428d5e408876601a7ea15fb9931ad089ade
MD5 b8a9fe6eeb217e2090588365b8982714
BLAKE2b-256 58908629c81bd6a3537f18f8b512795eadc0d35f14ee95895c6615e260c0ad61

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ee02ecf956fe7de9567a27ebd57cc0a7ed049388dbfd398b0a7c04dbbb061d33
MD5 c802b0977b853709d5e5a44c6a24d484
BLAKE2b-256 6bc1cbedf80f8632754bb9b37a9de85b5c4b763c7a0c5a89622eff174329f454

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11381fa129a57f2ccd511865257936ff7edd0f0a81a71995e1207836d1df14da
MD5 291b541ad0bfb8482599ba8b90733472
BLAKE2b-256 59f6354927b101b7b470698aef82a13b6788ce60736e5373f309b3ae0dafc39c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.6rc4-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2238826ddbc0e03038db7519532af6417ba10534391288d7a029f8a709265885
MD5 1777d0c165cc58173f4affb05b455f9f
BLAKE2b-256 06b5dffe001161ffcb2f4b6221c3c1ee64251639d28ee4d22a57633c17203b7a

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