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.2026.1500.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.2026.1500-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.2026.1500-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.1 kB view details)

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

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.2026.1500-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.1 kB view details)

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

lsst_sphgeom-30.2026.1500-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.5 kB view details)

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

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

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1500-cp313-cp313-macosx_10_13_x86_64.whl (631.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.2026.1500-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.2026.1500-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.2026.1500-cp312-cp312-macosx_11_0_arm64.whl (601.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1500-cp312-cp312-macosx_10_13_x86_64.whl (631.1 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.2026.1500-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.7 kB view details)

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

lsst_sphgeom-30.2026.1500-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.2026.1500-cp310-cp310-macosx_11_0_arm64.whl (593.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.2026.1500-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.2026.1500.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.2026.1500.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.2026.1500.tar.gz
Algorithm Hash digest
SHA256 f7488c410a805541883209b9e0ea7aecc0da572fdf3a8f6149f66ca426d422a8
MD5 84f10ff2a942c80d804d5b3636d8c8ef
BLAKE2b-256 d635de87fe944410d6665fb7212d8bff049c054d89e29cfe73c73993a29ba5e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cfe4448b9575e5164f88576ad33294a0b721e8acecfe61067de282c1afb9fdc6
MD5 e1efb103c6b7f318d74eda736ae075c7
BLAKE2b-256 16cd3297490630a9d3fcdcef6ecd039bdd9954e3500c346613c36279fade736a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 034aa3e2367286662612153c55b67bf5142af915639fad63b8e939e571bf4be7
MD5 85a8f20579a181fa6574addda4035197
BLAKE2b-256 9f0e7b6571d6377de1bbd982d9fc1ea736ba01b7b048299cd07003c8cd7d4192

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 711fa1dd52673c7b280b607e7c521d3d06fd474de2160f25333457eae9e8747e
MD5 63ae5c3985ff1526dbb05f26520e15a6
BLAKE2b-256 b212897a176f4edcc0a860b333b8a161ac3fbeea45e360e039752e261c9ba926

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 eb5a92ad8df83f8be30ff2432e99c7b4f9633683dd6abb0477b8d291ff07227b
MD5 9c8a3d614a4f33f165befc0cfc0543cc
BLAKE2b-256 f83ba6c38105b1744e7acbfee96817343ae7cb9286807d794f69496dbb355786

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88788f2936ab9f830b7bdc2ab8ea3e9322cab0d25adeb57eac2c8c667664dc13
MD5 8a9f3519fdee5eefbe1325a95c3af8dc
BLAKE2b-256 d03fe8612fbe25d74a3fb77651151f1598981df557b0b5fea5c3893dadd023b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 38722f509926cccc8ac828eb1b6ef02eef4a22baa76998da8407bf8a4cb6f08c
MD5 010686be997e1600e48498c6eed2424e
BLAKE2b-256 1d4e08c6be17ca69ff52e718b3f4f637c9e27bb23f02c39c835585a1b36f11de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efcad343fcb997f16938f960b71a97b0cf185d379d8f79315e2aff166b7f1b09
MD5 8bf6dbd83e347898aded220c61930b2c
BLAKE2b-256 c1f0e2f9e67cea90ab7137afebab55c47c4505f6615d7ef1f8f910027eba927d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 99d55b43d6982c0692ff54ab007aa33bcfa1634955a049a01b48c305e4b47831
MD5 3ce2621e6b2c2b1f59663da8bec34554
BLAKE2b-256 fa965c316b12b036663fc842292664748f689e065269cf4423743ee03996d3fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4b89580f7c000d89f47c5fe5bbafefaf187f86e0596aa26a45f9c2cb2da8235b
MD5 1a30e7a5657bcbada866c998c32f14f2
BLAKE2b-256 d4701e44194f086aaee69ecd91c13cccad3264c075171877cb82af6720b8eb5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5e6e493085ddffd628407b98aaa027b9ba7b25300abbfdf185885e5452e89b91
MD5 a529cc76b5cd5a175b886d53b9caa799
BLAKE2b-256 6811d04b2d8c6d258a32ace294ca1866a4168513395c9d9517c55b8876f1248d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79cc7853398dd97fc4a076a698233fdbcfbdd69e797cef096d7445258eed8476
MD5 de7226d8253ff2a1612302884607b218
BLAKE2b-256 42a8ae8301d20fce4c1a7cdb2e8f0dc0f9eba0486ba7199cba014db65bafe059

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3a38bba603e04e10081573ed0d65684f8ebf375a198e861fb250e7bc6fe54efe
MD5 38322bb25ca5827c305d6acaad20bd20
BLAKE2b-256 5a2847be943dbb95020378df257a8d47fb37080eefe4b5b1d65c73c4af8acb8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a0b0861fc89d98d6d724a4f3e9e9d94f1d75641bd92819afe9599db5c33afaad
MD5 0e1b4aa34316e601162437e5d809426c
BLAKE2b-256 c99bb2d44c03ecaf4fc85904e6fa5d36a01c712e3d26d1d972f3df4e22858359

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 47173928c4333b5a773ae6d358c9dae2be24d38ca465f9b408a90af5a1848750
MD5 9a8cdcaa0d2a19ab2421dd00aa6d4b7a
BLAKE2b-256 3e16bab8ac8fc47b77cdbda55db9bb316920f0c64afc501f779a66ea7b0da9fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9b9fb32d9dee5e73a0723fc76df83c594962973519fe38b628ca879337e09057
MD5 b3a1ab60a625bc2acea9ac9434a213f1
BLAKE2b-256 bfe080bd3e7c1793ca656f23a34bb29890b6544453e26c9481193a855e0f1a87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a463a318c08121d25ef182b22bc0cff99c942fdd01ee0dfbd9710cd57bf0fcf7
MD5 89ca8e5de0434ab4123c57e418c60c6d
BLAKE2b-256 e8295d8d3f5540db10d093385ca2b61ef275c5ead308ac8097ba650459b9b41b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1a5080189efd1d58c293d48efb317bdaaa6dda214224cee348f977a757912ceb
MD5 01b038461801bd2f9fe5a974b8efdb8f
BLAKE2b-256 995ce51b13596ba82c0bce4b55608e0d89461f28c378c5b807dde133faf45735

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bb75ff7ddac7f9b8825c25ecbae59191cc8337f8659ced0e9135f4384642d7ac
MD5 4116d9e3abcaf9c6abd745bfe24be55e
BLAKE2b-256 79e44518414f3d8782504e97d59a749ff95f91379ce8128f567fc73399b19437

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85b40dd52f5fb9c069690fa9eafbd3ef7a6dcf658b5daa9b52b37a585d1508f5
MD5 83f41bc874c1864e311b7c49d05c6345
BLAKE2b-256 6dd1c05c588ce202adddb605fd0add15778b9cd90aadfd2eadd2430a50b48621

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-30.2026.1500-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 956bbbcf5f6f62ea3152eec37469ff8883aaec1a7c4918ebe204bac6b2dcd632
MD5 b29798d71a3787511577a1606650feba
BLAKE2b-256 7250083735ea8c514a0a51c9558c027fd5067d1616e3383683bdac5d71e2bee2

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