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.7rc1.tar.gz (162.7 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.7rc1-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.7rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.7 kB view details)

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

lsst_sphgeom-30.0.7rc1-cp314-cp314-macosx_11_0_arm64.whl (602.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.7rc1-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.7rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (884.0 kB view details)

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

lsst_sphgeom-30.0.7rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.3 kB view details)

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

lsst_sphgeom-30.0.7rc1-cp313-cp313-macosx_11_0_arm64.whl (600.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.7rc1-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.7rc1-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.7rc1-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.7rc1-cp312-cp312-macosx_11_0_arm64.whl (600.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.7rc1-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.7rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.6 kB view details)

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

lsst_sphgeom-30.0.7rc1-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.7rc1-cp311-cp311-macosx_11_0_arm64.whl (594.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.0.7rc1-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.7rc1-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.7rc1-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.7rc1-cp310-cp310-macosx_11_0_arm64.whl (593.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.7rc1-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.7rc1.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.7rc1.tar.gz
  • Upload date:
  • Size: 162.7 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.7rc1.tar.gz
Algorithm Hash digest
SHA256 81d712f046f51852b85b8e2844c8f515898fd9fbcb785c0fbd7180cae5405ce7
MD5 b0d463edf4c32b5d6b86b0a0f689b745
BLAKE2b-256 6e999aab64916457e43629ef4b8d46518874a823b8fb23a615177aa5250f496d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 42dfa18e74eb47b382cbc3ef71419d842a16cac90c228b36cafd6abc271ac820
MD5 9eb5f7101431c23ccc107a95a0ffb2a9
BLAKE2b-256 5bf89881dd6af6f70c751a2dfeb7b06ad8ff3f50a4755917862815ddf95e6797

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e75d592e467a70d85a8203284c34c5287de04a433a5d20bda81ae81943803456
MD5 f73f1ab1836a9cc3781fe51fa913f7d5
BLAKE2b-256 d5ac272443a23f765e8e8772ac7f7c4f6a81be7ac3940d57a7d69cf32e59282f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3fc447493133aac343e18f2bf784354020eb2853642eb5831d8b68861ce50751
MD5 c5514e660f041b070266210fb68c94db
BLAKE2b-256 6b0f40ffcab67251ccbcd7c53f6b0d26cd509891d013dbbd73de728acb5884d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 56a0b966968cb45dd8d7e6a9d895bae795b822c2d755044d7656f8445ab67cd8
MD5 df8315b305ce066c9b9b3f19b1ef547c
BLAKE2b-256 1e12d2ece3a60d470e632020ce6f89465edf1d176cc359876c6d1a9fe8aa20ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af12211d6c4495e0d37da83801fc89f7092d799059a2cbe406cb7b5252a0ddfa
MD5 f16de2f80a86740a70955129e5b80caa
BLAKE2b-256 618589fb351e6ed8a4e2a79ba97e879aa5df867bc43dcce8ff89786fe14baf60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2fc9814871888c42f8a6605b689b762adb5e71b95e1b5da63f45fe1e8c5c0d4e
MD5 01bcdd3fdb7d3c624674340781bb90c4
BLAKE2b-256 d5b8459b5ea87d63a46712607b385d279cbe376487226f25d59f2182208a31db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b57eeb1e455a3309cf0e7f8ed4274462bf6775d3cb6b9bf10c5a2f25753d17ba
MD5 6bfb83cb873816a244fb751e4ad224af
BLAKE2b-256 b3dee88f51bc779dfc2244a63e53a5ef365acebb9ffb639202fd494061e09b40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 39c2e72535f5c61ec95ad6f3cc37f8deb4f117c01e5a6b590247fed9875bf2d7
MD5 fd821c5a16ca86d5c7968f0d3e628063
BLAKE2b-256 139e533900ca4d9da460bb382b49689b7bce4036d515e8c53fa9e4dfa812d95e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b392fa478dde35b3bec339237f2502a4c4ee374724e13f696230d6e289defc62
MD5 2e4e77f11d17d6305e218cefa359470a
BLAKE2b-256 c2cc8626b7d6f5fd8f9d46ca9386b0ae7cdc74337d2ffa7db8e820a4695486fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 82b90c8d361664a1186e2a548facc07a82ba90e52049b0f99c94a34926f74fe7
MD5 b12d1119fad677a415af36b246330d01
BLAKE2b-256 424e7208f080dea87cb68ba42e65acd55364b6ffbcc45b64ce8ba789368ea55e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3723dc8cc8476026b9f58015e6ac99ce68c74b60552e683f6425eb73c130881f
MD5 4b7ad808b0b5c4deedc40522c28bacb7
BLAKE2b-256 a3fbc568fb5e50b863382dadad5d3cbd6e3f6c7746cb7d4305bdb71f2af62f3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a417edea52e5078be769a6b915dceff57b7aa170d6f64e215583839bf2e245c2
MD5 243ab9efd451475726b995d5a3ef9635
BLAKE2b-256 826451947184fb4c378022253e95c9fc96ffe98c383a7fbcc4e831a6cba54f9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 456aa45c8ec5f82125c68949416fe106cfc747bf8aa4ab583df52298b88277a9
MD5 58368a9bd7f08d89563a89f67025ebe1
BLAKE2b-256 8b27f5959d2afef91ed25ffb8ed2f1451c508a8c318a9d6545ae1bfe46ebec41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9371e5bcb7a5ed3c1e21be983b97e625d7acf8313aef0f3bab269dd6ded61cee
MD5 e726adbcf7f2509446bb365dc82262d6
BLAKE2b-256 fa633e95e24568a0b35812fd13d9a4a817c5f41fcc093ae2eec6bace0e91af8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf8b9eae8fa64bce8c9b36c4c8e83d0b65e1eebfa01507fb869075a498dfe258
MD5 e59623fae7a108814917f316f0d3fca7
BLAKE2b-256 54e4ac7fc711e6500d16728c57837b602440e0c6b574191433a7262174b0db2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ac570f5379ff2af2d4de84f4ebbded324ae8271eccff0d88c3842bd3189de32e
MD5 aa65ccb26cca2a50d56850b7d9095772
BLAKE2b-256 302611ce6c96a43969e4434bb4c6b201bb800c4fc09e953d03f1987e548f933a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f2439866e5f38d08f3769c63715f0fa5ede23f3f258185f1456b23566375ed44
MD5 1bf12bb2f037b1ad62663e7c1f9ed861
BLAKE2b-256 c4ecc10da3f26a2f015b721785b59c579b375ae6c6b196d1970a1985b52f3e8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 448270b2587028928de265584f60a3444489e2fdb54f40a7fc4ef536b20fa720
MD5 f2c2315df059087beed30eb139b5db72
BLAKE2b-256 2c800a97a765766bc2c6ff8b96abbfcf2728c27b6f3df81e8465b498337eba32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54354f5abf68563c2d37e35b346800a920c149625fcfa7899b15317be5966309
MD5 28afee28dad3b198a7ad116617826d4e
BLAKE2b-256 fa139e63cc23671d027ded5abfbae9cd88b91fcd9a0f3d6650ed9155c258c87c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.7rc1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a42322134f6abea6f2c180e30d1861f95a39746c15e92f844769dc02ea5cfb23
MD5 9dc3abd97ce91cfe1b579f0c136d2d2a
BLAKE2b-256 505c2540b2ae8f978621fbdd931f4cf53583697baafe3a930921fe3fa8145ad6

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