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

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224400.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.0a20224400.tar.gz
Algorithm Hash digest
SHA256 2e0068c49e3d4b0f4d1a70eab3b07031d64982a06e01e942c28791f69814480f
MD5 730198ba188b43c7e08c6a5f9ae883d6
BLAKE2b-256 d96371431a107daa3d74d31ae6c801136f537bc5047bf58a12128e6281ee2d96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 18b39a190c88b1f0bd6901f2500c2ef1cd792fd0257a65234bba9117d3d40f51
MD5 0271622c678dfdea6fe522303a8f915f
BLAKE2b-256 fdd84e01543130df4708120bc11d1a8f17db98c6821a97d432eb8220f0e321f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2aead033758e4572405582dac781be240d57b9425d17f17fcb5439e942df793
MD5 cc5929588185427c3dc84431a6cb1048
BLAKE2b-256 cac5974c9cda9b532dda0ae038940a20ea83de3083ff48df532c9a6d94028c47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f1a140faaa65dfdf99650a1dcf743165977fa5a8d6f76a38ebe50a3c13c3de90
MD5 06d0609a55136592790f57032b323358
BLAKE2b-256 66a94df428b5c5fac8da1e4f09c26a738adab61af27a985db43a3a67f382cb56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31901ca734fd7d80a04cf8d41767942fa132ee68e949441d6d8e39960c2f9e7e
MD5 ebf235096d477864ed77f27824396ce3
BLAKE2b-256 bdca716695cc61e0a3e21a55b2668123595303b4c13ac7d5b5f41ea8832e0239

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f688ab455e868a8b26906a7b053d5031e79953d00ab4fd9bb8729aa5f13c9eab
MD5 5b8f764822dd4f7217ed73c7636170e4
BLAKE2b-256 a6e648473959811c66a8e7827e2d0bf069ce872ca9b0d369e589fec2d7c631e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22c250956cb10755919b1a89cec20bf66b80d85471a57223ce35232da7d84888
MD5 7424135f08a1601c2ee11d94304af0ba
BLAKE2b-256 f96ebb5e69501c91d630dec975a62f856c216d6b12f17425dfe433a78fe3b3c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 66e1bb2f16dbdc95a55eabb319da6c1932141309cceecdea6384f88b97a2a71d
MD5 32980580af54fde7b7e8bb8d7f9f27a1
BLAKE2b-256 c56b80457ec362b36584247d9a6465c4ea4794c20335b677ae15519198204d7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0831d873d2a56c315fa4d8124e6de238c7f24daf419f4b36823af528b8e0b277
MD5 ef630ce5c49efceb9e91462961c3cdbb
BLAKE2b-256 9b51966c1dc78f0f10087fd8c2ce977815dad1733958e60d5f92653e8a539632

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224400-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b3b12779637b006d626d3c72d8e8b8fbb1f031fbd8b39957677851f90c56484f
MD5 e9b30161640e5d73d6bb9795457f27bc
BLAKE2b-256 235d343c3ca5fb469e0c2552e152fd8a45e0bb675e62f32942c52b3548274c08

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