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.6rc2.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.6rc2-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.6rc2-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.6rc2-cp314-cp314-macosx_11_0_arm64.whl (602.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc2-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.6rc2-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.6rc2-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.6rc2-cp313-cp313-macosx_11_0_arm64.whl (600.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc2-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.6rc2-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.6rc2-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.6rc2-cp312-cp312-macosx_11_0_arm64.whl (600.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc2-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.6rc2-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.6rc2-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.6rc2-cp311-cp311-macosx_11_0_arm64.whl (594.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc2-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.6rc2-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.6rc2-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.6rc2-cp310-cp310-macosx_11_0_arm64.whl (593.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.6rc2-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.6rc2.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.6rc2.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.6rc2.tar.gz
Algorithm Hash digest
SHA256 1ebd63d2b75f3097155d821d60384a2c7cb76c8a090a016007a0e2617a84c9da
MD5 5e2aecad917c5bb0123b416529298ceb
BLAKE2b-256 62d3da9ea0006b40f78a650d9fa1f5354093465e04448f082b3f87591255bb4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 27ff8b4bcc99e24f4a9a76de29a84b39222bc87fd3e89b327ade38603dc7651c
MD5 a4021d8ae68ef3ef35e7d2231170d825
BLAKE2b-256 1d010cc59bd08d648420f914691637e2975cedfd75751dd822b3a5dccc60686d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d136edf73802270fca3892290182386b8cb5687d966411dfaae0fc7da937aad2
MD5 6246584b7ea2ed943ed228c1142abe0a
BLAKE2b-256 733bf10bd75cba6540f630dc19c1d35e37eb5fbbfeecbecf71b7a0427e8deaf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f96f5c3f4650c52bd0a66a59185411223ff0dcfaa3e71a83c471a00f3928f2e
MD5 22862a7334398ae01cc4e900b4a4aa7e
BLAKE2b-256 1c27d8b94573dccc50832de027000a187933873a548e42f370aea02466b96d54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 c90f56e4c21b99dc179d4f32d85a143ac95f109e0122f3f32c1327db034a2c58
MD5 23dcfb2220fbe724e60719a2398879f0
BLAKE2b-256 a5b540619b7aab2cc130f30e246cdcef0b5d8749d424ca6ce0b8807ff7de807f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c6110557e0946ac284a3a5a89f9e6bcf73b265683d346cf2b0a4f6ed800295eb
MD5 fbb09592b4ea4c126d25d5da822d22f1
BLAKE2b-256 6a293f70360c2bd03e5833662e7db1431075f06faa68e880cf48974840fd1f4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ec2e862786c337f8030ef6eeb1060d1c3401d5a5370102d8e14c7cbf711bf986
MD5 50036f19cba0f760ac5f934b35232c95
BLAKE2b-256 a163d9f05e618efc076aeec07bdea632921222edeefed9c067c5251d7e2bcb8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 daae059b52a3591d02ceeb448ebdd467406194fee0c749178d90a76f724cb6eb
MD5 83735fd3a6e8e7c5dc76c0a6ec39bb91
BLAKE2b-256 6af05c9d7fd45fe246c046f753caf695d051de4bca96deeb064d037a9dff1445

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 1ee9644155be2222b68a8ee5300da9080062a93720dfe738e3b9d877dab67b2c
MD5 f059732e2ee1add2ab0a904378cded9f
BLAKE2b-256 8ff4d8a7128145825065adb4d8b333e490cd9c640eaa6bcb0b183b8480b184cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 440aa91b64b73e22beb268864f469e97927fcec1f04dba1ce60e461315e9276b
MD5 f67bed468d28efb7505367116c60ecbf
BLAKE2b-256 e67491b7cd36ff8105f4df20ed716561021c3a8b41cacbb6eb319b3d58b92588

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 66b8c56df8c0a1a101e65104166c2034bd78860ad2e8715f0513676f119757ce
MD5 e709a2b2d1e9d0ba1d198c4ec89b97bb
BLAKE2b-256 889c05d1fb0b9c031c1fb9e424a36764af6ef1547fb0579b327f435c7101745e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cbe89d96ed444eeaac94a294a0d5f1ff54c4951c7df9304d58b098a98c4ec894
MD5 bad3727f3a411d0b50f7c1f383daf325
BLAKE2b-256 26ce96c347a323478c82b38c577277625700e8923f3a3323c2ae44045ae8044b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 17b6765e83cda7b545087208014d14b00728375c7f086c00d63f6d2532729b37
MD5 f745181e2b6493e41b531199edcb6c61
BLAKE2b-256 a65ef4e46eddd3bbe1b838a56df786b012f023bc792679ca64cf97077a9cc9cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3fe64eff5af30c7defea6d206129f93c657799b7acc0a34c761593ca103a461b
MD5 cf7e4828b79b71b1c08d09568cc9ad98
BLAKE2b-256 9ec9761e280ef6eb041a14a2ed17557d8e953283068ff7735939d05913c70495

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 673188ff1033ca3a59205d5f4360bb85a1a37f2ba3c291d4b5f54da6e52e4f48
MD5 cd3fc003cc1409ab250297aba2fecad8
BLAKE2b-256 e90925cb8f17aff802b2e11011b78274eb7eb59de15efb0a8661286a8c9f9e5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5333c2b719297173a6c25ba877e0d7ed08ce825ecc25bbbff8b932ef1eaec1d1
MD5 013a9c352e28e489fe84c91bd4050206
BLAKE2b-256 de6ee2303ebb0a0859d469b940b371c7502c34406b3c080e9fa05f440538b773

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 143282ec31a566332df1cbe592df2ef9301c0d5b5c955bc48289c4fc3ab8ad6a
MD5 496c4faa4b716e92a67d411bd65533a0
BLAKE2b-256 e559c8cbea74fba0913b036339a1fbb116271bf9d5705000aecbde5d6e94da6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d47c2b741d51b2406b60948a3d8dea98875c9381506d2b81636287f9fa2ae01
MD5 a63818c39d7de196ce97b3a813f15d10
BLAKE2b-256 ad9f665ebdab100d875992b3b8605e6e87d3feddc76ed9f85fc3d3ef34062e39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7a43a53aedf7e278da4cae1a991c95fed6101802b7afe3e3d0449ad01098c28a
MD5 3e65958a6ca92544e82ec3ff90f3bf75
BLAKE2b-256 7276b390fe17acfbe0e07e0b554a29ac9908279e0dcd97e07349a26f4d1acb6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d09d353cff39ffcfdbdf8dd557c0a2e1c947d22807ca5d2ee9b38e6d515fdad
MD5 9b3bedccf55eddcb0323afe5f3e796c5
BLAKE2b-256 d5146c3c3725bcd9e934463c810aacf8f54fc8ca810a2c611564cc9834960fce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.6rc2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fa95651734cc3f0b136cad35d6b9a077cb605e88d8c92b7a1772ed24088c3f81
MD5 d24ba28d9b943ec398339ac5f82247f9
BLAKE2b-256 ac64d8711e607923abc2bcd0b6f357145a90305ceabe17a337a9b0471ca8948f

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