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-25.0.0a20223900.tar.gz (129.3 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-25.0.0a20223900-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20223900-cp310-cp310-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20223900-cp310-cp310-macosx_10_9_x86_64.whl (516.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20223900-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (656.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20223900-cp39-cp39-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20223900-cp39-cp39-macosx_10_9_x86_64.whl (516.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20223900-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20223900-cp38-cp38-macosx_11_0_arm64.whl (495.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20223900-cp38-cp38-macosx_10_9_x86_64.whl (516.4 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-25.0.0a20223900.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20223900.tar.gz
  • Upload date:
  • Size: 129.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for lsst-sphgeom-25.0.0a20223900.tar.gz
Algorithm Hash digest
SHA256 e116379812fc458199dd03ebc20624879b8d0831507b6303ee36e55845837da6
MD5 cc65e2806dee1b2d6685c74b09bda233
BLAKE2b-256 5e98e36d0d1120993442e08156a653a3cff56aeea264e5c700811fcabe3b90f1

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4dc67061db4a2a51703a6d1fb4b60369e1ac0d8b2637810e2f03a04896594668
MD5 6914b1e89445f7125316eb9e17e9179b
BLAKE2b-256 1bb158b70ab9177f6d132a4b0185f63fa7d4d97559a545425bbc11e33bdc8df3

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b5017b1801fbee706a8e17efec53c85c2e60bd9c41b6ad300c5fc1a2bd76ad1
MD5 4829dfc2f9330e90abd3e8681e0769db
BLAKE2b-256 a670bd2f38dd8ce0bad346b76eb3666a7c7062d86736ccbd5f881b88e1c35278

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3e10f6d03c928adb51ab25cf69449c6546aab172a5d6df73d993c87ffb951cbb
MD5 5ab306b72cd01c9dcf875fd3e0cbae15
BLAKE2b-256 4a1ebea05c858e6c11927a153eeed8546b8283a44d8d4d36f91d11e071903b4d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2b39d4685f5b2a2bf5e79e14cd4379c53265f6d1a411320fe188ffb11fddd47
MD5 420cdabb60fc57166c68f1d84e551296
BLAKE2b-256 d85ad95089bad4d24e1510574ab8ea1afa1e66b6904289297e915c56cbbc798c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6ed5f620a4a9a9b0ced6d1e64a2fd1db6d8957fe82674d317f9d5ac5c1305716
MD5 38084f0300e8a04de5cb381e14f626c8
BLAKE2b-256 b9ece88ad03f548b5ccc5dbae7cce453587f24f230d6a6a7f0df38cbaf01730b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 403d514034431cf6c2538ca0f0c7dc26239ce2ed40c6a53b363ebef5f7980b50
MD5 fa621cb33532e0b27be6a6437c4427a4
BLAKE2b-256 7c0a40fa59b1b60f5aaf2c77cc5449828f239f49cadc359611d80fde039f8169

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82d641fd4cdc8f7a7e69266a4ae173fb82a35e00b0a69dca882f8aa8a2173999
MD5 60e5325a3dbd8f57d9909caff642d3cc
BLAKE2b-256 6fdb721e27b69675979b67e0111399a2da7efc52fc2b18815e5df2a22ae9aee0

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec9a0ce0300c4806f6e673b59db99c7478fd4a1837520442a4f01ec336254a3c
MD5 9dc118de5e704aefcf51cdf3a83838b4
BLAKE2b-256 f7fff4bae5c2c63d979d6b02e06e343d0b55e3c1927f3a48994ae854ea988fe4

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20223900-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223900-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0c6033a5d14182779891bb78801893adf26e4e5742f38f08dadfbe9feb587792
MD5 ef15da9a2320543b7f86cc6e0dcbb16b
BLAKE2b-256 55d3d3e2b8a4a3aaede34c3de92052491bc27a8d5945a28a697fbfc1597f7086

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