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

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230400-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.0a20230400-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.0a20230400-cp39-cp39-macosx_11_0_arm64.whl (492.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230400-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.0a20230400-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.0a20230400-cp38-cp38-macosx_11_0_arm64.whl (491.9 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230400-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.0a20230400.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-26.0.0a20230400.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.0a20230400.tar.gz
Algorithm Hash digest
SHA256 af4ce1a6a26194dd8b6ccd5584ed6680cf81a171757671984c0f706f958decb7
MD5 4bd00c79557ba1a56b01a6307c6d4690
BLAKE2b-256 8027e530eece5b37ba08d8b12ccf0aa3171e0c6d9fd358d5f8ebddc243600417

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c72813d75beda1e0e94679126f981f35bd476d0556f796080114658c010268c5
MD5 47f6a267db04aa318c08141b8e48eb46
BLAKE2b-256 b5376a3d609baacb9d478d99a8d6a89396ddd649df9e96d25921bced8c34693e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 208d583ac23aba47eda3758a7e54d2827bac2458574525c6b083bb9bef36f99e
MD5 417faaba83047d25dd628a6dce63d221
BLAKE2b-256 f3f7f96bb6be4e413e9f3e1cc6054c983e000e267b7da560f4f18c98dbb2a4d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4c37cb7e9a128bf495cd3e0f80cc95b9288ade58f98bc260b1a5038490ce02f0
MD5 2d257bcad04f7ce67fc26c17b3509fb1
BLAKE2b-256 1af0d09693a5722915595541c2a1f2eb459d71f5a0ef72a729339d6df8185b4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7b14dd5cb8d8d1480e17478665ce8550811cf4003c4c102df709b149c75a70d9
MD5 909debcdc201e58f95e6531a11476875
BLAKE2b-256 8da0c881c92a6f6f495216c66c033f06ba39b1d6e159f226f1168eb442a5fbd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fffaadc981352cc4aa977321e3ab37f8bf5e77c31b6a47916e8712aa8c5fc223
MD5 be8f5658fce87cb24d4e38accf071c73
BLAKE2b-256 8e7328c4ccc4957b66465917569134b6ff357ff1eba5e1c8c8bcfd0037a7eac3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b31a3d4283b24be467bab07c923e1c61a9a5516efce1b7a102e2bf80f25da6cc
MD5 3b871722e2ca291eefee8e6bef69cdf8
BLAKE2b-256 b31c66e317cfe91a95e0648d455544e76745c88567c44d70c93b983c674a7bcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82500eeab029223b51b6f2b959551ee65de75aead7f011b111fae16d76a978ab
MD5 50c91e712a36689d750f82519ac4e822
BLAKE2b-256 d36d46ef7af5c7cf3090e82f9d1c6db4ada9757d8895e636f6fc4dcdd99ffe74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94c20f54955897a71af16e36c13b5c5b1948c86f49f3b723cbc6dfc614e5738a
MD5 d686e6eaed0ec38e857fa7da1f82c14a
BLAKE2b-256 e07068df2547d9c5e4a59034d11b63bf7829615f2e84a720534dfb4a1c3e5fc9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230400-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9cace91451fe2152a5f717b2d9f4297f796c46c2ddb6be76a469ac264a4867fa
MD5 76f15a2029fc1bc3b58c18c7e6968bca
BLAKE2b-256 b0721a6ed8ba2b0d7a195e87c63dd618f2ef10391fc6e94073411c3c761a965b

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