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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224900.tar.gz
  • Upload date:
  • Size: 129.2 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.0a20224900.tar.gz
Algorithm Hash digest
SHA256 1462103a1ef518eb967b2fb829138613e398e597329162ab2e10f4900144ea9a
MD5 ab364bd1ae1ff170842f8b5e5c89626a
BLAKE2b-256 05fe78723e467aa932f1a4a02a9138ec77574d2ca25388eb856f419e8a6b6af3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e39a3cf6937c4d6d3bddbe142869c787d7175ed9435d7ef8d5832279ce559eb8
MD5 3f1e3d83ced76f93c6145260ad4c8634
BLAKE2b-256 f2b33d5cbad60a5b63c697259f409b5112931b2a71870e3bd32ec1f9c9b2437b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a038d65a3817bba9668987d0789a25391c4bacf90accd8bc24723f5960ef271c
MD5 9a23a12ce59b205a66722eb60b279f9e
BLAKE2b-256 d677019722a438de0d658bf36b3510e26f0561a602eb904036a13a4737fb8191

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c8475ce437300f326ccdb88684b0fdc7cea5862d4154dcc0ebc98a40ff566ce5
MD5 5414af0b9c38db490e64d6709a2cb7dd
BLAKE2b-256 de2ce4cc9f659b782b9a8e0ed624d2e318397844f3702936b1ee34e72d2372dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12f1a84de5b224c684520072c4831f197ac57779702c7af3da628b1978f2e911
MD5 e56277d1161a50c4ccffeccaaea17e56
BLAKE2b-256 a323918b92165dc55a63d25f1f0a7c19c148c3db4634abc2f3221b0ba5012ccd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99b27dba280e8bf1ca37b8442ac4f476e106d1baeb51f0e7d3224907e03ed6fd
MD5 b69cc017063ba026fb23274cb0b5cc05
BLAKE2b-256 012c876062446da1eecc6ec451bc4b7e4b8a86133c0af43bbe5c6528e6c86a73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8999f0a40f5f549208ddd9b7aa9481d0d06578d4301910dac5fbcf2db5247dd7
MD5 b6b4914fc324c916877571eff67bb7aa
BLAKE2b-256 47aecc2fc6de1df23b261a8151c3948124c8668d3252ae29aa8856221603ae64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b201e6320032856946784a5e83493838fc3bba8db3e791329e6a2c99da8ab5be
MD5 de6767542c8ef0b424912d245a112006
BLAKE2b-256 ef8c8f0fad990c40980d791726fc6b654f5fd0c54f800fcf4544def4cb3a6489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48328c0810a4b7ca11d9c7cf2ace00ec619683b1c207e77dc47a9abc7d076365
MD5 ce0aa675ea6e223117ef38baad490343
BLAKE2b-256 c1a391f93e97e271a4ebb11a5a510f0e6ebe3dcbc70bc4b507e5023a435b8b9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224900-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2767169392e853a3f56637880c422123dd09c169faa319343851ed1645293125
MD5 9dd3d82ca2c42441e0e90b699f8203aa
BLAKE2b-256 d672a4f3c59a72aebfa6405d1c23ff38dcbd6ac100534144c70f5a888ae0a554

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