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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224800.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.0a20224800.tar.gz
Algorithm Hash digest
SHA256 2113a7b1395178bb27db5e62be2dfb94413892477eaa3af5cd10eafd46152ef9
MD5 0187e89cc94fd4117c8ef8cd73fd99f1
BLAKE2b-256 86076691665c9a8f40896d148c51b70a8c580508a76c28020baa32f8a05cf72d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d668ac07d291b6c5b0c428c744cace2f4e3b29d90923c73a6b29a33fd65af055
MD5 d859b7ae69df0e59f4580e0fd80c106e
BLAKE2b-256 1cd0371e72fac8e0b665616fe57e676c7d19739390e18c623b6a5bd04a28c3a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d589fe7be12ed2f1acda56cdb8c997a36a2056c50f1b322b80c8d36234d8f9fc
MD5 21457c329880edca3c6a6ef18f56570a
BLAKE2b-256 75069dfd01cb6c17c1c73ea691466c2ca29022a42100d0eae98239ca5ba986fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0890d808d9aa4272b58e5a06f3805ef9992904c3280ed58e07f70f6d51e9cc71
MD5 6773ec0e14663ad195cc66b69fbc87c4
BLAKE2b-256 7ec1bf145fe03ea0a98c47cf4dacd350d029ef02a5c11181c55a47d80a81fc4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2dee75ed6b2fbe962a485a069108c8a86bee0db514eb601979321fd1c48204cf
MD5 8422504e0692e0fba63083a5cf987482
BLAKE2b-256 301f893e313ae4ef6b401e3b7dc4b3674894ba4f99a056f423d5fdfade07bb85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2686a6ca7164a6702c1991fbedb3d78f42f6813d46301adcb97dcc5291b3a19
MD5 455a63a92093cde79356799c39b26d8b
BLAKE2b-256 0f7113af765e350a409c315d4695305d1236725f87208cb7554c663c49f9157d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 780c2b53500d8364cf9f0e6b7fd75fd9f032c5bf2fbb82b2eb7ae18923b1ce69
MD5 d735a7628aff6edb17d8f6fa055d8bee
BLAKE2b-256 13f5240952290d7ff5b71be406f43e0605e0e5de5c82dff0e7e270180d0c999b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 35944c066acb83973dec93a08296a77d629c43394fcc14626eca867776abcdd5
MD5 175303f7c962917ef748bfff6d054229
BLAKE2b-256 ccd096eb30cc1eb8e820be32c0988ecfc36ec66603bb9391bb5cb68b5cbbd746

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 afd04599a682ff8b05f32695652898ae99ae3cea959528a65e9077b9332caffe
MD5 970ecfc195462298c22d21b1ea429f25
BLAKE2b-256 d1be13d882d030f04acf2fb4f73cfcec039c5c0bd39ff29ed2f1caa073853e96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224800-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a4c7443f002de6ad030addf0b6c2f0fc4d32ee0d0d00a53933588201664db2be
MD5 528a556c4e4ddb4098b0887c0bf8bfc5
BLAKE2b-256 16b85416b5e9154038a1acb63c6183bd2af03115ed3d9a62f961cf035ed291c6

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