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-26.0.0a20230500.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-26.0.0a20230500-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (660.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.0a20230500-cp310-cp310-macosx_11_0_arm64.whl (492.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230500-cp310-cp310-macosx_10_9_x86_64.whl (513.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-26.0.0a20230500-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (662.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.0a20230500-cp39-cp39-macosx_11_0_arm64.whl (492.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230500-cp39-cp39-macosx_10_9_x86_64.whl (513.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-26.0.0a20230500-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.0a20230500-cp38-cp38-macosx_11_0_arm64.whl (491.9 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230500-cp38-cp38-macosx_10_9_x86_64.whl (513.5 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-26.0.0a20230500.tar.gz.

File metadata

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

File hashes

Hashes for lsst-sphgeom-26.0.0a20230500.tar.gz
Algorithm Hash digest
SHA256 a5a71b0e02d067c6521bafeb5f9d6e5a2f2396f7cead38cbf85677b15ca04e7f
MD5 685561166c78b879e5317835bbd988e3
BLAKE2b-256 f0f5d9c5306bd0967d99703bb50960e2ad6cb8f8cc1fd27af82bdb9915f2e7f3

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6a190058d640ed85efda10f82c2bc2c315bcd7d8fe39b30fdfd31887da07018
MD5 04c75e364f03972a8824e955c7f645a2
BLAKE2b-256 f5d2e2afe7ab0d478bcbe09b927a85fa2397a65251d8a5d9c18539e5115e623f

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f1b7bf7935e61d5e6fb7c0dab2237f6247701784b3d1262f80256e79c4ab9659
MD5 819a300606169fd947988c742b828526
BLAKE2b-256 8f86987caeb39dc716312c0d4a7056c486f99caf4577ac77f1c44df22a5a9413

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c685e818d66f92b2372acad5c6ad19db8309de51005359b81322087f0893575
MD5 a7120b7e2c5eabd57410ae976ac39e1b
BLAKE2b-256 4da32d26a92a66b37a58a83ac5b055847315b1a6cce1b2e750e8233cadc4f94c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2105dd8858a32de38e7c4ace70a1a4160f3777cd38188388b99894d22daeba2
MD5 93f2f39b7bc2bccf955b0f263696c6dd
BLAKE2b-256 f3b63b17f922e4ed0f5f4bb1867eb9295f0100db9674f321eeb28fe119826c90

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 841e630303c30e1478fd994742be9237f3b47e43c5501c46724448ecb048f852
MD5 cfa9bb891edee91468b0ac600fa412ac
BLAKE2b-256 b066cd35ff57bcde01eb05f25c7cf5ba82661da43f89413c341f6170bbbd85bb

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d1536c93a7a4b3e681c370f1063c6b708442e9bc5f97b2189e3e29360a9bfe53
MD5 1b4f68376cb7968b8da99d038b23fd36
BLAKE2b-256 d4cb9743ebf8cf8d7543369583f15951980b0f80d5a7f71375864db36538e5f3

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1017bef73f1bc1ae2d1a7d2d71636df0019f31f00ea559da86a223b510c63a73
MD5 c17c02c3f88458c15856e920ce6971ab
BLAKE2b-256 06790923a3c133177c2649d75e4e58be13efe5be19544fba7cec853cee3d65ff

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e08f97ab8218a2115aa3608c862df56a04f4a119c1406319795239a5841a443
MD5 6987308ae3d3419168a366adc913bc7f
BLAKE2b-256 55cb977cb8984813a80717a14fc1207ad71bd84f2b5ed14bf7e7f428545c0884

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230500-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230500-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 13619b12b44fed4ba6016babd5909310c64fbefbdb2ea1f0cd584fabe957d50b
MD5 279a7db63109e1c3463797a8a921d09b
BLAKE2b-256 ae470b36b22a21dcb10e73a709a9cff43e54569ec3f3ab5ceb71c149b884bde2

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