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.0a20224300.tar.gz (129.2 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.0a20224300-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224300-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.0a20224300-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.0a20224300-cp39-cp39-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224300-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.0a20224300-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.0a20224300-cp38-cp38-macosx_11_0_arm64.whl (495.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224300-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.0a20224300.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224300.tar.gz
  • Upload date:
  • Size: 129.2 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.0a20224300.tar.gz
Algorithm Hash digest
SHA256 e292e5ce7b6210a1833c061aec2e433efd447104c14c070443558bb4eb11cc9d
MD5 58c1d341192ffa6c7f4aacb5669fb9a1
BLAKE2b-256 b94609243a08f6cb1f7c1d19a611a85dd806c3b17b5ca34bf3880aa672aad7f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de8006da01c3950de9c032e3f4b9b8431547a1c99354f71e802663917495ba41
MD5 88818c8d730664b59eba84acf3617eb0
BLAKE2b-256 11421799fb2c58cd83511313a5881cdc8ff5a9edc361aba032113a5811f54856

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d92b6f6168b3ce8455d427dd34bcc959d6d4292ec3fb2041a7ae2b951f540e86
MD5 f8cbb2d588652cb7853d31f1d38e4c68
BLAKE2b-256 a1252eee3141dfae9ba20d72d98d95f7fa424ca3996901e476f7f31171717720

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 446e0b0aa7900e909a962974a7f25fdea0fae67757b807c1d8dba7547b56b563
MD5 aef62fda37c20e9ef529b1caed706a16
BLAKE2b-256 7c4020b37fe55037231886d7cc0433c3f11d056f8fee04cb418b67a45c865d71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0310083e6982c90ed6858eb1fef6e4281ab7c6cf1a4424fecd621e34b3e2084f
MD5 3f3e5266ec21c9d9ec6695cbe65498af
BLAKE2b-256 c8452495c91afba8859aa40e52f533159eb0ae5fa6a2afb81faa754d82ece830

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c70c030b2119db19a91a518b9a9c885b08f2662d1661d02c96c29446aa638af
MD5 861ad18c4332ede30f898956f6327948
BLAKE2b-256 de26797d892079ddaef3c7207decf9cae3b834d3a057cc7b381deae08dba2fc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f5a0c9c833317f66448d1eceb63954180f2149c6cd8d805a91c2047311c4a1e
MD5 2f7ed42209be2f18922aa0efda807271
BLAKE2b-256 8a4747e43e11945c596b28d0e28d6e6ac6afc12c7a6fde90ffb9b1cff403ebc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 89868e9f4a71779ff2d68ebc6500ab21d3a1e363a37463c898ca428f8fcca535
MD5 29a5629321640cf34aba4b43828cc871
BLAKE2b-256 0b7243f8b86f5326ecb385e65ff4943e9541ada5803855206812cf455e998546

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8a371d14e3b171cfcd08256d2fb7281aaf43e177c0a25e58dd818e9a0aec8fb
MD5 0923594aeba2cc8509deeb34a0c98454
BLAKE2b-256 678bb8126bc1f55bb42f77767727d702b8f3afe432e8bc1e8c44d0902f466151

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224300-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ab5679aebac104190c17fdf4274e826862e672cd0d1cf76dc92e7dee4a9daa28
MD5 80cc99aeac1766876122df4086853fa8
BLAKE2b-256 ba3fa47b4931871613717e55559ceddd367b71cda426166528383a47fbf22cef

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