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

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20223100-cp310-cp310-macosx_10_9_x86_64.whl (516.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-24.0.0a20223100-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-24.0.0a20223100-cp39-cp39-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20223100-cp39-cp39-macosx_10_9_x86_64.whl (516.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-24.0.0a20223100-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-24.0.0a20223100-cp38-cp38-macosx_11_0_arm64.whl (495.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-24.0.0a20223100-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-24.0.0a20223100.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-24.0.0a20223100.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-24.0.0a20223100.tar.gz
Algorithm Hash digest
SHA256 bd394f52f9425e57759d4231e7a675f798b45fd0f67878cb9433bfd6176539ef
MD5 1c288538f0aa3bb26f9c032cd73c1324
BLAKE2b-256 db33659d42528acdb98051707248e301aa22f07bdfe4f39c3913612bc0642ae6

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e1999017e284e85d23511d73287e03f62166f8dfafb8fc167f60d9bd0e62fa9
MD5 b3a32baa7bfbe20fc2fef905274e1221
BLAKE2b-256 7ffcdf95819b2c4ed6dfe90122976014d113f23e9d0f1e88da60adddb92fa5c5

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09c71cd926b401a2103d5ecbc224c4a129134bc3b7dbae006c791627487013f6
MD5 9ce5c7d137f6e5c93c96aef032d4a5c7
BLAKE2b-256 572cc1e757f7ef13ca9162fcbf8b15b9da689d342b09e260a9e05e87e1de778e

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 04c9949569b57eebc0c55c2550521b70a275bdb76db27280984149d8077fe6c2
MD5 73a7f58f2f196c2e76dadf9874e851c6
BLAKE2b-256 e3cb898645bc851cee29c4a8138be8d522ff18cf94cb3a5b365ff17adb656b1f

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ccadccf2ee0b9d391b7dc141cd55af7168cd6b59f5dd781b728eba6afe928f31
MD5 00ef5eae4675d91c474afd7b6b34a08e
BLAKE2b-256 69ded7d9b0ffac4b517e8f2acf9af4bf33fcf96fc54a2d0a8cc00a1adcb410b4

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b74acc979992f4caed6a2c18cf8eaeb58631cc45e61a02bd6aa0e4407c1522c7
MD5 ed837609ec28a8703a070d66fde7a812
BLAKE2b-256 fc683d8f9dd5ceeb9d2320e660366b7ab8df54c3b7483252e9803bc26c11c699

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 668fdfbf36233f0d6099e168a9418f0672c4c0106ac9ede278ed00a4fe0de00a
MD5 40b1638a85487cfad697c1a559fad917
BLAKE2b-256 a648dce9ed843047ae8d5cf8a68bf309fee75d6c6e1a240a96e49aeec4912ba2

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f75683865cabddbc33577e2df0cd6373070735371abec1820c6b2ebee199d6a
MD5 2794474885e38d02904eb52a092cd510
BLAKE2b-256 48bbd220a1d3e8a9d83adb6d1a17eee1b1602d7bb8d7f9e6ed089eaeb739d3ac

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 341b0d28a74b6c0a44ad34c085fb1d82086658ce95b61c8a4e6275f56e5c0624
MD5 9851cee0dacfddf457d5380b706d0fc9
BLAKE2b-256 379bc0fcfbb9b6c749cc7061a893e3fda925ca9d70631f37c7ed98d44c967709

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-24.0.0a20223100-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223100-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 386c1afe2d2d6e096cf5074c3a848c37beb5c762d2e8b66e8373a2ebf21fa1c5
MD5 77c386d1e8d90d1e7bbce419a2cf602c
BLAKE2b-256 2f1e0c78cb13bd08461f2f3ccf82b268ec1aa62b9464ec91a798eb2e8776ded6

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