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.0a20224600.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.0a20224600-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (659.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20224600-cp310-cp310-macosx_11_0_arm64.whl (491.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224600-cp310-cp310-macosx_10_9_x86_64.whl (513.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20224600-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (666.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20224600-cp39-cp39-macosx_11_0_arm64.whl (491.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224600-cp39-cp39-macosx_10_9_x86_64.whl (513.3 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20224600-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (659.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20224600-cp38-cp38-macosx_11_0_arm64.whl (491.6 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224600-cp38-cp38-macosx_10_9_x86_64.whl (513.1 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for lsst-sphgeom-25.0.0a20224600.tar.gz
Algorithm Hash digest
SHA256 eaf5e9a1c573d69f8fb50c7adb80a22e1c9da222af366667db5c41e13d3bc094
MD5 7c1ce22a182a2d0b9298b998f5735b8d
BLAKE2b-256 267dcda4bea824b20ed35f5aa8562f590acffbea0257c6d3ad83e3814dfa4aeb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 858109b20b8a9e9667061c74a94079d2e8571061ff5b75d0680f5983f1a5c9f3
MD5 ec280e97ca5bd3d5d977dc909981a183
BLAKE2b-256 a6c4d737f372150bbdab9d9da0dde2fb650fc91d725a61bed1875acc0d1cfb88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9a7c3387353770e591eef78c7091ef3b69afaff251490f7ee17ebcf17f55f9f7
MD5 a96a938166a2cf475449a85ec4cc1686
BLAKE2b-256 f38e213c022118681a4bd93d354acbd2f9f216b7fbc62bf283bbf391fa9cc238

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 281a1caa767ba75874ec0323674a18f6e95656037f216099a0d0da8ad5156f02
MD5 2d6d1a47866d4fc64ac0616a3a9f99c0
BLAKE2b-256 26f9ce349462c2da09eb95d05778b8186ea37ab6cf55efdae7ae26b874e5c0af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88307827317b744321967622ba92855300fe7827291473a0dbc1ae49152746ae
MD5 a5f2d872cebb09d7254b10186928dce1
BLAKE2b-256 6124c49016bbbe44204cd9744630630481d60521a36b6fdcd0f501b83d1faeb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6d8f9d940bad1a77f0b4bf4f60756a7c87e359e7d382edb2ac143b1f176f684e
MD5 445d2592674abe2160d997f64955ba69
BLAKE2b-256 41f32bd46260b24655bfd121f037d0afc82d19747652651e89736342e85d9e1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f66e5dda56243f5576195ce24aa95a25ddf83cc9b4ea138523a3f6f9148ff433
MD5 e2aa6220ee9fc7fada99a389b1fb2ec8
BLAKE2b-256 69e8bfb939cd31fd9ae60409df06584a57ae8062796e3626ca6399a47c9d00b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa025413541e3e42d908b274be3b44c741c03ceb5488c0ae7687ec7c7e7c4f5a
MD5 e2c056be9b69669771af80b01516ce8c
BLAKE2b-256 e11c8cb6a4781035717ccbeb6bdc7b5ae67d6efc13207e1e6ee32b5a92e992c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be2b243861e302b581bf6daf01b214ec21965254b4c98f9f43a36625c6a070d2
MD5 3506df67f9a85ac90eb032676f61708f
BLAKE2b-256 ea9561929612dbd09a16696f9ef3f31fdeb4347c2fc2a01c50053463d76058d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224600-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b62247d6a5b07e40523e1a8d53082baf141ece177866a6c95e1550ccc2d69f8d
MD5 2c710f85b2290dd394acf4a95475557a
BLAKE2b-256 f7314f9689ff1506a849cded2679d2f3b1148cf9a8df46b09f33514a1c021100

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