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.6.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.6-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.2 kB view details)

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

lsst_sphgeom-30.0.6-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.6-cp314-cp314-macosx_11_0_arm64.whl (601.9 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.0.6-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.6-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.2 kB view details)

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

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.13+ x86-64

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

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

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

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

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

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.6-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.6-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.6-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.2 kB view details)

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

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

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

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

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

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

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: lsst_sphgeom-30.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 602d47fa37fb9ac5609a1aafab83af8d5c3c79fb493b99e2c48a686d4a348672
MD5 d69169a56fe7222763ad0f55c9405226
BLAKE2b-256 09642f0281d577ca8be32abec5c94538579c6fcc6c8dc8992aefdea3af8c09fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fae0a601eabca0db0c459accb8cdfe60293f78fc632298dff92ad158911992b7
MD5 412763bbf09de817d51b90428a1dc1ce
BLAKE2b-256 170c62af99a85dd20c96f5b3192953be4ef090401be27f2e0c6b28886592053c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a53fe08e675a8622ed3fb6a2e2b94e043e10ee463bcce149cb5e09ad106e6077
MD5 09d265c3c595729baf3518ab4bf7935d
BLAKE2b-256 bb9ca38e481a99790f37cb77a9f1ebb2178b20bb2a5da392825a758052b6ce5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fde913750e6a75f618a939f41405076113f35c81a89f146ba048f3ac5a72338
MD5 79bbb0191e7efd688fcfd1645ed75098
BLAKE2b-256 ca9139f0f048447967166107ca4f0bb2b59321a06d89f8eb291a2b23b9c519c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 c9eba46e02779267e335d58b30b0c2c18c4a3b7599089ce5c8493d7fe9b8a8fd
MD5 5fc7ce723bb2e8b3ff9ee51221976768
BLAKE2b-256 b84fc3e0dc0c0cdd085477b50883cb458e34738ccb6f6251514188d852206cef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ccaf6a694af7c63697c3ca680bc269f2f1f32376f3155707ad860804dd55b8c
MD5 8ed080321dd2dd9fa6ac7433cd0300ba
BLAKE2b-256 6ac34dff908460b3b49dd6913ddfc4cb6d79cbb9eebff831a37149fa2f6fae6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9f56df555b2e823b1a9db593b23f62eaac4587888a37b0af678adb098922bc84
MD5 68147a1d01d1290eb340d60ba2701eed
BLAKE2b-256 8a151f408ee2f6ccb7628e58d902ff4a46ae0a5b23781d105cd334f8e69aadb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d8a274b7a8c8edb37d9043a85e86e6487f0d35e2a1407655c889d8349a7acdc
MD5 5606c01549ce64a4af1ffbc729f0cc75
BLAKE2b-256 6583b9c29d386919c205132b717326522a3b322295f5e4f036236762e40ea1ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e3097a660f345830f30c34cf144dc1965c1cf93ec3035419f04d410fceb818f9
MD5 359d8cbc9e78f43866803c17d3b942a1
BLAKE2b-256 30bc2a429fd36e5dde81bad4eccefb5e15a50bbc55ef7ac64c40667143859f85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 108d6b00ffa56fa5fef219307e0cba1dafcc70036d555f676bf03ac00d66df2f
MD5 dc4dcd2d1469afc83d57253241666df9
BLAKE2b-256 d1f6fa69995bbdf4b4d89d61c19c631b8816673aefd4d697c3b12f831e3b197f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 306b1ef57e88e046635342477ec8c673892c7449f09b42ef16b4f0126e901ad7
MD5 420d5f4aa9a05f001d283fd0a3165a35
BLAKE2b-256 22abf8b3aa4d83ba824fbbfc086a20f7e1d5ea882aeabdc85899ec0d4b7f89c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0bf069befee5d315e2520b038c9f613de1a7244ece1a71725afc21d904079594
MD5 714620f98098f2a7fcd2f67418ef77cc
BLAKE2b-256 14a6cd5dade1d034fb7aa583cb33a93830ec66c9c0dd7d366f6920a42ba30dca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ecd9910beb590b1c674db5c8af8d815b4d130733804f51c31766d7f34b8a0c1b
MD5 8621a8b9c884ceccbe038942011da062
BLAKE2b-256 c70d6db92d176dc660825ccb502ca62a0ad9393d028fd0e32b6157f8b81b5fb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 55d1f0a9500f7f050ef56d208daa5c843add1c677918a7cbeeadb20efdbbd74f
MD5 a94ed3c315b394d1756d4a42ee5dea09
BLAKE2b-256 92ebb790020f4d86b33bbf7d9d8e9d0099bd08b5a3d6a66492ad7a5f94fb46e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a4d8f7ad8decd6bd82ebf3d4e145ec6d2ceb86db7fd269601e0aa4d4d95d45fc
MD5 867eff3bb4652bf8e830c630f43ea1f3
BLAKE2b-256 893fcd4f3c2fc16b6389276a333c36a198b2e6b49f0e9dfeebff2ebe72e7fd73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bbec63b4bd6c03e3f3bb73249d3c02b2d42e4125d4043cd0d44673d64d4adb4
MD5 aa778c7f54f4ab7ac84d15e26bc47441
BLAKE2b-256 2c6e4ec0f21cdd9a8297663107beb30c9bc2ca2d477d8403f64b05c5507d41b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5db270dd3c5f7f00e91196e9081d35660609f5b8cdccc0aee564ae18a6cdf085
MD5 e287b3ebc8c58161675c23a0ecd7d5c7
BLAKE2b-256 cc52929ab30570c592e1f4d79452dc917a2be938c04758ef3bd9e0628d9e447a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eec33f22ff0c5eed79cd8a81610d955b803620e1a85261c7d4f90ac0e8d052a1
MD5 72261402f9fe33bbff736088a288640b
BLAKE2b-256 af2f69b6af030b7c59b346fd3f813af4070f876cc4a1350c75ffc9be89ec2b91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3105b9df09278a7107eea46cba1b2633cf059d7df84e9249e223a059ee977ca4
MD5 15bd9007829d5fcc997d437ce3f339a5
BLAKE2b-256 eba3e0e50f687e0b5f056df39d303e37a9a890a5b91ff328f773b75f3b911b3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7432569cd5c3a0cfd8304793a19c091f4053435abb2dd61a3a57f5bf21d76e14
MD5 023733fe27737abb0aafb6f7a9462b4f
BLAKE2b-256 28a3ead04934a5807bfcf54633d7786d9e64ba05662bae3816924afdafd2ba3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df9610e80d9dc62b0d877a6f24e6fc31072a273cdd8d93083dc092938844a1ef
MD5 5873288874b5c643fa17d7855d497b6b
BLAKE2b-256 eba3bdaf83cf08b44d9131c6d31ed3ac11a589d9229007d9bb160c38b3117c91

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