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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst-sphgeom-24.0.0a20223000.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.0a20223000.tar.gz
Algorithm Hash digest
SHA256 74523369ef8c991f13860854b2a0ca26c7fbf30f991009d8c7a288f9ced6579e
MD5 2fb305e24cc885dd883137693d0344db
BLAKE2b-256 45cde19813bea0c52b897f9172b5cfcaec19adde9dbdcc53a707158df5321a2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 46e7ac6fab14a735db63b9c3e6f6e26047ab64a0f553cedf179cdb64746993dd
MD5 b3cb3e0ff3a684ae481c7fd19c96a3c4
BLAKE2b-256 fd6fa28db7453d2adb6511d5549db6199a20055c6202f14228950a1bcac86201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3378b72fa599ebe32a007ee6e123e03b2066fff68ee4620274714fe65d8906e7
MD5 6379b99ce075b4f22d681ad3a1fa600d
BLAKE2b-256 069249ae83916efeab30281e234f2a090810bb6a767bde4dde3b8150ff56d22d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 76724bc97b2baa0c25f3cf438972e4232686a46ff5b358786ff3fd87848fcc96
MD5 65022f72653abaaeb612e004f37f5f38
BLAKE2b-256 8e2b4faa967f622064a21d22077f76751c1aba2bc24972e501f82308de5c8e56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3b4c7d9ddacc6af92c0eadf60f9c50d5fe8f95445f784502f8e24b83df82fbb
MD5 099406059f4b23cbdb5d204d7407709b
BLAKE2b-256 cfd8d367e5f530071c284ca7bf400da0b83724c3e67512fcaa2318b4b1b180f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b347e101b5a18cb5da0ddb2c95682e96cc0618b1ac0afe9888e70d66bb4d12b8
MD5 feba99badce10e8415b7ff4b266a7e73
BLAKE2b-256 5f370101d71935f732c03e79edb464d4fdf16fc9d728b7b4117f7bdc3ccca601

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f80b067c73a5e1ae6bac1044802ebdf81b913820ccf3ae9144992208c35b86b6
MD5 3dda595cf9a7be5e8fe05bc36c7c18e7
BLAKE2b-256 2d4b86f66fa0f7d660e03b5af25c43bea94d7b4e2946a98308c47f12b9be77bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2d6c27906392f0f91e7c7f2d201dad6c89145a681c813bac7deb0c6aca89cb10
MD5 d8de5190432c42a785ad0328afb46096
BLAKE2b-256 d8c1f3c05d7c8a811c5c663575930af83a754481c88e5e5732ef4418ecba9cbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e53c86da8b6db4ca4aa26177e1c411690061abcafc077e63bfdbdf6ca2e60640
MD5 02d9dbeeb77028629e7b780f6aab8cd7
BLAKE2b-256 f2602b3b2280e608e48a916a1c3a142fe5dd1fef11e5e4ed185e2e83d104ba98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-24.0.0a20223000-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 458b12652adbf842e8a6b60b8ffeda662c882c51f7596897720a79f0a10d4103
MD5 678084d42a2f5b9128d2742eec38b487
BLAKE2b-256 ab5e01a64545218307a9155710f66043f6c68483a5094de1e2cf254c5e23397c

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