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-24.0.0a20222800.tar.gz (128.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-24.0.0a20222800-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (606.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-24.0.0a20222800-cp310-cp310-macosx_11_0_arm64.whl (457.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20222800-cp310-cp310-macosx_10_9_x86_64.whl (478.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-24.0.0a20222800-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (610.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-24.0.0a20222800-cp39-cp39-macosx_11_0_arm64.whl (457.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20222800-cp39-cp39-macosx_10_9_x86_64.whl (478.6 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-24.0.0a20222800-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (607.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-24.0.0a20222800-cp38-cp38-macosx_11_0_arm64.whl (457.6 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20222800-cp38-cp38-macosx_10_9_x86_64.whl (478.5 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-24.0.0a20222800.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-24.0.0a20222800.tar.gz
  • Upload date:
  • Size: 128.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for lsst-sphgeom-24.0.0a20222800.tar.gz
Algorithm Hash digest
SHA256 58464a8dbfe8b9388af3fc441ad2c610dc997d9402b4a663e906e7a7f34fac94
MD5 00964e8da0af45e94d1eac384b91d640
BLAKE2b-256 578d44bc04d69a081020073dc907f016560ccbcfaf8d9b28cdc85ddf48a101df

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 67e7dde6f4e343189bc54416873371d3f7f861b4b152c6011e39b7b79e9dcf98
MD5 f7522d3f7426ec9b602340a422dd15be
BLAKE2b-256 d0bc6831337f87a2af0a5eaa2cbe96e571c31b914e69fe97502f626ecfc6c96d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d27657313ec0ca2b08c8793d60b7d84b207601851fba77be13535cd8645ddd7d
MD5 c4fdaf279fa9b9d0d41e6de48f0d1a26
BLAKE2b-256 e7be234b69ec62096c2dc19b5e5adb1b005d4b42bca50213dfaa111d6a465f2e

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c06b61d671cdd41fdc1c854684d74420760f98da4d98aea8ee79e51504f2d90f
MD5 242ff9c19fede2d06c8b578c84411af0
BLAKE2b-256 a7da553d04971c408ac7129cc226534698c62c68001f2ed1f7210b1d78958ae0

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 18133f575ce987024c49a8e7b8049f27babd88637d479fc841172fc0d04f1cba
MD5 f91c855337fb98df7b43397f330aa9e6
BLAKE2b-256 1df686ca98407a72dbcc0c95100300b9e3afbe965e7feff7bb6344d7b027246e

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3407cd3241846fbdcce51ade8315dc0f7208ae9597873a046063076f2339f6a2
MD5 56e7dcfea90a935bcdf7d67326782220
BLAKE2b-256 f7655b1a3cbe64791a5a48f2b24bd1a53d8e37f7941d027bc94809154a4a91ec

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bee837f09b81d21e60f9f563f5964b9c1dc4598ef72915224656abc3dceb1cdd
MD5 1b6e538f1ce55a4b00c8b00fc46674cf
BLAKE2b-256 1e2d409d77f45b754e770af12d824f61882cc242d11dfea33be0ee3acf5de93d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 709bf9f6cd707777991a5cc35fd62189232f95055500258e97cd839244e6b4fb
MD5 e9a246808700101999497b999eb3e135
BLAKE2b-256 2185cdad4eac1987ef7716fe2662884b6840b748c69cb8429d4d314ba8057cf9

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f8d41dd74d1c71be4054fd6cf9ffdd212488970f0aca8fe190ee62a91d960920
MD5 af987b530673d3e513a4a27e0ef6288f
BLAKE2b-256 3c588dc40328f1255274f1093a2bf5081ae9cc0fd239ddeb457219bd88216ae7

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20222800-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222800-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b08ca6cd89056865ba45edc0a4eac41be89c360d0e82f8d5416b26ae44e78af9
MD5 bbf973cf66a14f43999516fc5c68929b
BLAKE2b-256 10ae41b12870c060e952fd1319e855e1b988a071cc25e2f39e5211b9149b7382

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