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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

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

File hashes

Hashes for lsst-sphgeom-25.0.0a20223400.tar.gz
Algorithm Hash digest
SHA256 3a074bb7fe426b986d1b5b8def8afd4faefcc908bebbaa2cec16bbc4376f8286
MD5 1d0b4ac65b4c87b78238f100a707bb7f
BLAKE2b-256 27b90ec41bd4dcdf2fb7520887bcdeb091ce355a634a722799a6d0b2ca3053ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f393fa57a5b0818fca03b6e4ae128fe15e8447045bcce3fcdf656e9027dcc248
MD5 5d3513b5d8ba54b395f5f211873be9ce
BLAKE2b-256 4024d61e89b2ad4a7d469503eb141c60833c6bc5fa9ffa82c2bfb7cf7d761536

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c5665a36b2565e8683c33aef3e48178fe3efa7bb5862e42ed1f5417d1fa0ff4
MD5 f920b28d41d19aa5f2bee622dbba4819
BLAKE2b-256 0c62e9de901e301fc968b741445ae45d9ac505c20133969b40df1d28e65e197a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6490afdaf66173c708a85f0231e589eb95b0052ba1c7d7168357007a6d989460
MD5 a57dc9fbf30a2e4ce94f145176bbe14c
BLAKE2b-256 a181689867ad76a9de04be142ed599a9577bff866e1817486f3c8432316aa4bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f8ccee21ae1d535ef9e8f1bef1055f63f3a2a57cbbfa68a4ac860fd9a1a96a8
MD5 f42fab1efa75754a2b05a3474eaf48b4
BLAKE2b-256 15c5e4d4eee6d6014a994bf2ff70257a59e94c989ede6b9349b3f4e29193490c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a3e22549f0c4a28df385f03d5e3de30d6b6b0f682f2d04822e1066da23c5a6e
MD5 acdeea21cdeb3538809c9636c40044e0
BLAKE2b-256 8849ad0e0be06806f8f6015618937e340da5403aba69f6d87196e8da95b6d42e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 75b3e1134ce162206f83425f4f70bbf5e6a2b4dd8e17c68d532dea5bc6ab4af6
MD5 4b96be9c38d1d5e50c8d8f879f7d1033
BLAKE2b-256 3c62f29bd02cf28a700d61cc32a9e56427a816d3b78eea2bd4013f43911b1cd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ba98c7d509f69cd93715d147785bff8c1b0c94ce238152e54cfd9dd57938c95
MD5 be035da60efc4da22d2bd67e27a1ef39
BLAKE2b-256 fe10a561ecc28f546f4d2c2d3fc8571c6397b8a4e04db97102a66425c6450766

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 011580cc4230e7dd40bb1bb6a7cc0c18adc03d1f7b948cffecdf4c4eff1e6111
MD5 f7ff8d177c16a10f9054b372f24c9b18
BLAKE2b-256 f364c478b6dfe14ba7fc3dadd78778717a9045c3c14287299666cc6e92605963

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20223400-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ded26f810fe838723f4642e1655cb643ae3c1b49ba4a6500108b4a2b06dc220
MD5 075d2fdd27da78cc0958bef6b32ff1d8
BLAKE2b-256 28a94521d4b2dce8b0d4e18eff5a9cd1fa664e246e651281a69b70b25a0ab076

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