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.5rc1.tar.gz (162.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-30.0.5rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.3 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (833.1 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp314-cp314-macosx_11_0_arm64.whl (602.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.5rc1-cp314-cp314-macosx_10_15_x86_64.whl (630.1 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.0.5rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (884.1 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.1 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp313-cp313-macosx_11_0_arm64.whl (601.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.5rc1-cp313-cp313-macosx_10_13_x86_64.whl (631.4 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.0.5rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.7 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.3 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp312-cp312-macosx_11_0_arm64.whl (601.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.5rc1-cp312-cp312-macosx_10_13_x86_64.whl (631.2 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lsst_sphgeom-30.0.5rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.7 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (830.4 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp311-cp311-macosx_11_0_arm64.whl (595.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.0.5rc1-cp311-cp311-macosx_10_9_x86_64.whl (618.2 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.0.5rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.8 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (830.7 kB view details)

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

lsst_sphgeom-30.0.5rc1-cp310-cp310-macosx_11_0_arm64.whl (593.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.5rc1-cp310-cp310-macosx_10_9_x86_64.whl (616.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file lsst_sphgeom-30.0.5rc1.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.5rc1.tar.gz
  • Upload date:
  • Size: 162.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lsst_sphgeom-30.0.5rc1.tar.gz
Algorithm Hash digest
SHA256 c2fed0b26b9f204f1ce1dae3019218e321c4af79569557ba13a69055caf1845f
MD5 72314091adc6d76084f9024d241f7df6
BLAKE2b-256 8daace79de770c4f0c70a2c9e5badda02cbb2a0c9098b69cf72a7bd7608ac8ab

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5a62912d96b0738acc2f32fe9eb5c03b5060d21f1666d200b9660c0a163a0d09
MD5 d28f76cc6874f4f292f5ffba402eb3a5
BLAKE2b-256 7187d67892123a1d30736bf20c9939465292e6a20c5e7f693994bf0398e29c0d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 50d4f53950be41956c36d0c9ed6892324809d57b930fcab0fe018f81ff169bcd
MD5 ef9f8388384cdc474d2d32dc44800017
BLAKE2b-256 87b17113af60d27d362a1f1b199a42cdf1cf923715d69978d5b7d11651027540

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ae78f6fa04826aaa5b8699a2c04b395d2a9874e37b6c62ee36991c3702e47e6
MD5 a57ed773af3360ebbc2e96a7d704e3f9
BLAKE2b-256 0ca26e31a4d8aa190d1d76761e127a15d3b48744df7fef1f7511f73bbaf24bfc

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 793e6403a3bdb82c22bc0247c9681548b4ef25cda724bf19b38426b38babc07a
MD5 07eaff227272274068672598d7a1b0b7
BLAKE2b-256 08027259a7bdcba6ddc2d5687d57c47ccd8aa48b39eb48094e7bda05f490430c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ae9c33101cfd6d39ec6d03ac51171dd26cf1982f57f4ef99ed8820c5f90f995a
MD5 fbe86d948b7f27c2643acca6e96b4172
BLAKE2b-256 41df26e173ca4ad8905609698585001b1f3c53ccc590e5a2d1c6e95b3e84c307

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 56de2686a846f7a0bd79f6f33283353bf1e3e02f69a7e66fe227f15854b70801
MD5 67dbd5391ccb9132441d0759329512dd
BLAKE2b-256 aa2619fd614e726a16bf8444c9a426774b410aa91c012e5153c2a7d2e4a200ce

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3f38881b98a96d4e11f3550a7e1b821f30beb00f1587c59562216f6f3dbe62d
MD5 75cb260d20545267915d8980cf836996
BLAKE2b-256 e068a5fd7568bcb67f74994348e9203c8fe31f2096c91bdd32800e1833adc458

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6195bae28ad3b5cfdf758e7bc79dd3f7a91e0c75a133bb2622056b74edb8ba63
MD5 318ff43d193b9bc8da7ad948e7b0fbaa
BLAKE2b-256 bafa2ba69f35f59ffd2b8c788a26c82760b59829877773bc6696b09c5ced119c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33b300601a7d5a294221150da30cd3d128996c164f8d5c6b4e951e3d8773c0fc
MD5 60c93ff34babd0f359425d8d81829384
BLAKE2b-256 b7d561a39b9d7bc6a8597187162e1193b51f07da03f1b659691bacc81b3130ae

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ba6308e1c14a25d64734bc4bf35a7b72ecf7102de0e7e81f5a5130a6fc7b7907
MD5 dd239442ddf20066b023315c062cdb92
BLAKE2b-256 3b2a6ab06a8714b8a61e01ceee1c751675af11b811a8e381e05bc12979ffbceb

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfe2f1d1ae303db1268ce901f54ebae26ba474199e47fcd8ea40685162ddffbf
MD5 08086e42d351a5e09a7cfc35f81ef970
BLAKE2b-256 7f8d9307e494c45b37e9b0f5a56a669b6ceba927749e3e3f844943a8da155b59

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2fb292bb566915e5285a73d5179f48e1bebd6d871a758d3e84f257a18b2d155a
MD5 2ff643da960c3a8b3a1fe205c3724a96
BLAKE2b-256 10857d01fd7bf0085ddac0ceb17b3c78b274868ca51fdd185b7871f28e9072bd

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0bce15fc5a6d0b65be4e8faddbb2ee3a7e28b0a759eb862d410c91ab574f0e3a
MD5 279065ecca32ef0432dddc7a58b07069
BLAKE2b-256 86fbc4fa1f1cf18617d4376632939bf38858707b41d8f3a923512fadcfb5a53b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1c2d4416a9573cffb39b23dfb54690de0f9a679c0efe46f878595d4e4324242b
MD5 d892f3ff345e8518d5b9b20000a9cfc9
BLAKE2b-256 9b666f9bb3d25891365fddafd318ec5f0ee5b656f6384d4cd279c933082ee004

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49f17f46aa8a14792debef10298e24b20342605c3b62271188c1cf655a0ade71
MD5 de2155ab5fad3beb3ed4d174614937bd
BLAKE2b-256 6fae8c5884ef499c1854795b19821d6fe7662628142a92aff38066cc0b25df84

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 704d6a749de1030c0a0e0ac0fa9cf64976185a815cc560a496afe1f988b434c6
MD5 69e3a4a2bb52f685ca81639c6fb7f930
BLAKE2b-256 0703dc67a96e0614b9196ae76950093f8f7d0cfdd5330717d8445232ab01bfa9

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1f33dfc5e7c1360c961034660634c667f4f88f27b96404b9d2ba158caaa2df17
MD5 cd4ba0f62f4a06088fab13c0bd0afdb1
BLAKE2b-256 cdd4b60bc8fb8354552d5bdd78531ebb2e8c77534f0d7988d2f489c6a58605f9

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b923edb247e66fb047b40f900e76991eb936265e32d3dd8712e6618da29c4160
MD5 0f301ad67564b6dcd172da35a3e94a01
BLAKE2b-256 dcedd3ec6349f7a6936f57e1d8dfaa8cb2eec7c6977aa2a1348a3360cca22322

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22d6eba6108fc67586890d2e83e04883129460321c54a858f8c4772b88e153db
MD5 a4f9b22fc923203cb7740a73c61364d2
BLAKE2b-256 8f5809143fb80fe5266bbb2a7bac0e20e0967ab67d02fa028e412c065cfdfacc

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.5rc1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.5rc1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7366c76abb941c6b941e5d169c2531af742d07bbeb128d725efe3c9ab62f7fa5
MD5 5ed83c6cd81c59c507aff2a8bfe89a67
BLAKE2b-256 e4fab682d9ce69152a159c68af5e6c29be7ea87cbdee5d7bd33a736d6fad2f47

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