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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224700.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.0a20224700.tar.gz
Algorithm Hash digest
SHA256 52c0ef01598ae68203316c2897397d1d27ea2d5ee3771ca6fd83c135b1cff676
MD5 c4838ea2e580d12704c1a835582275f5
BLAKE2b-256 725d8373b6527b63613896b7c862fb720831e4a729854db7bc44bda62c074a8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 445be4b9ddaa121ac750e8ac63e2883fddcef54afd3860a9ad27d6221dc652e4
MD5 f20bb4d30c327b11142eccd91f0311c3
BLAKE2b-256 72a22bc3d9d0da86f5637af1784184fe5045065cffdfb0341b42fef44a8ba7be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69762f7cbfa15c2ee0307939141d8cb98b0e03c9b9c28df5cb8e8eeffa97946e
MD5 4371cae70e8a81498102d432489e6bdd
BLAKE2b-256 45f788c050b39f9cc3b0078bc0df247066edf7c3bc033faf83b5ffcb78121644

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b6b79b44b84195ca97e1733ce52f82d761558766bcc2744feab2802527e1c2cc
MD5 e90a1937c778efd59e1e45d27ee8b268
BLAKE2b-256 d218240f24d94f0b5388b0ea3d3bbf6b21eefc1980b2718635b8f763931f19fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d039f12b622350f6d27a644cc749bf42660f5272c3eff730178d4fa19cc03647
MD5 b8cc4f81a0b9f7555617c76afa010601
BLAKE2b-256 6489656dd63fdf823f99cfb97df4ebf03d33b3ee09c31bc59524cd231639ba13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ee36ea6e283306f8b4afb0f8ebdec0a0d98b015b8b5fe4fdf3b827dd9f8c409
MD5 140dc1dd0c4c3b5540b1b1562577de38
BLAKE2b-256 5ac492fc38b11ffef72d01a3dd497a2f8db3d3f0dbed66fef2b9948630734361

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f9dae042d0701711d3dbe2960a54ab16751585392eb3833919313245e1cd2852
MD5 0dfc4274c7df2da30331fca2176f1f32
BLAKE2b-256 76c74ba6c7238e5c1572173041d7339fe749ffc696cc9da4e7e2f6483cf68bac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5ff22a78dd61d83bfac6940343041646231cbe838826b74fbdc38b2abc1a8ab
MD5 2ec0dc01711faada8eab317008a2b420
BLAKE2b-256 12b78814c8b2b55d0231e7dfa7a96a378f10fb94986817b78f6b92bd83295d30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 215c17fefcff1800dd139aef0b1bee846be090d798e16f2bf4ef57673ff38ba1
MD5 83620a342d7613d9a08e79a514d872ee
BLAKE2b-256 e3dbcc20126cf63bd1698f5364dce3ed8c8c1e68532a018c0b895607bab0cde4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224700-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8fbe24aad9400b670e07a54d78aa7081bd599d946bf1d7a634fc143ca83b91f3
MD5 ccd938b1bfe71e118d156c10ba9c3d6a
BLAKE2b-256 ac10dfc796d3bbd894eae278bea2f3a09930e694e2534e49ecb7efcf4f35b8e5

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