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.0a20222900.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.0a20222900-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.0a20222900-cp310-cp310-macosx_11_0_arm64.whl (457.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20222900-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.0a20222900-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.0a20222900-cp39-cp39-macosx_11_0_arm64.whl (457.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20222900-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.0a20222900-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.0a20222900-cp38-cp38-macosx_11_0_arm64.whl (457.6 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20222900-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.0a20222900.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-24.0.0a20222900.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.0a20222900.tar.gz
Algorithm Hash digest
SHA256 b1ded351df9dee2ef494ba82913e857d3a3c707924a078384afd7cfd5bc21ae6
MD5 dab2a9d1b239ddcf2ad065712b941ad3
BLAKE2b-256 f62944da338094cb0f61eedbd55aabdb74651b574d46959b05e4d41d4cece46d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb71355f44884bff21dfe26f493294923db3ab792276c70113c0946f68b740a9
MD5 25e1eba8347aec72634f8ee60109d69b
BLAKE2b-256 927f9ce327bf0cb2128f1eb2b0df7b86aaa2467c3afe693a43faa6e3a4b0d762

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1552362dd2a200652912d67a078754fbc9f062bef9b84ec2902e84538a81a86d
MD5 80a3553809bee9846dda98c395b6cf36
BLAKE2b-256 f05a81e0d4bfe4aa04732e8fd0e3cc48ee229c241e7eacfa313320d9fd33db55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 17d0eeca4fbdff2d49694067183a8355be07bdee0d9c5c73611f5c1e85ae6425
MD5 ebf704facb681cb883cadcc0a515e2b9
BLAKE2b-256 0a54b2717fb13bd9a5f2540a2821d866fdc63cfb2835f4a104cda72df571abb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08d276e97c38aba83d5cdf7b900d1671274663c4292bc65eee43fa4cbf15de29
MD5 59aa9eaa60aa6c75ab32a10486eb58a3
BLAKE2b-256 2929b340f8b8af4a7d7961e6fba6c13302ecfff1d99045db67b79fe61cb120b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5ef62962be4040a73327860cf14fd8ec87da397adb18cb7233f1174ca190c47
MD5 a94efaf6d549c5cd3a842f4155eb0711
BLAKE2b-256 0454eea228a7502007aa1fce71b8c3871cffd68f7c95fc1591e09f1ccfd289c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f2a84fc2f0eaeedf8b78980cc823a99777a718a542d613d8672fa692e03e6e5b
MD5 a0d572630bd0a1bcb7b12d372129b24a
BLAKE2b-256 f2fad84f57c341291ff79b5a0a38da2605737d97f1bc1c913e65d54580dbf997

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1de680a219b4acda765e4ca250bba58977f8cd51ca5ab8b29f4ede1461e14bb
MD5 25b1629f1f472a1b67a0a133bf05407d
BLAKE2b-256 b002f579a6c387eef4a7ae6acea78947a519b26dbd50c3b6ff91322a1b82cbf4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11db41d2d779df5c2f048ea9473227661b7eabacf868601e7b0eaa334ce93b89
MD5 b65065c2391fb7b6e8a01c4ddc1088a1
BLAKE2b-256 486ab0acc313f215e2238b1be7cc1b31c6899f3bafbc3f526c5b2ba514bf5daf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20222900-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 78aef02f0e45ba2f8fd62c15ab7581546bfaa87de1fd11e7fd37d9364c1aeec1
MD5 2d4f66fe1d98e51c4e62fd097daf3689
BLAKE2b-256 a50f0b803077f8cbd529cc0cd48148476ff4c08d29cf7d1d1902d7e8b9ece9b2

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