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.0a20224200.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.0a20224200-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20224200-cp310-cp310-macosx_11_0_arm64.whl (495.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

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

File metadata

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

File hashes

Hashes for lsst-sphgeom-25.0.0a20224200.tar.gz
Algorithm Hash digest
SHA256 92d7e9eaca04690af1988054c2c959191d3ed41dcf03ae9c321d98a94a7224ec
MD5 ad7cb5c9a8ea829fc67a10837dff7d6a
BLAKE2b-256 76fc51013f1467b3877d8260d40094f452474bb797ddac3c27ee71bef5266d05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86fe4389e993d1392f8007abcce0e0174a4959c4b59a1e48e8afb994e54e9ed6
MD5 88b206e8557d71c3cc694b9b0423d4ce
BLAKE2b-256 e7bc1d47b40a0e465d823d25946401f17279cc7151125e25a2cef17f48f7a19c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df496277178bdc83e10fc4c1d24a6c4fd4bfda9dc42e6d6e0c56ae0551496df5
MD5 f2e6f0e7f8f4e3a8fa63732331970c02
BLAKE2b-256 8fe5b3d20057d847d8a647876d81ffa608bf18e6d22a3bd99ce50d1cf67a06b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a3d64e3097c40c204177eca5f168c3b2681b97fa43f9727f4a5779c7ab980717
MD5 dca6a4d02f52c344b496ec29b66f5b59
BLAKE2b-256 fb96d171f696203ab482fd33dad84040a3295887377807bd396f17e271f4823d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 735d550bc17c67bf3df55e77ca60bcac93979e88bc8dd805a89b678af5a2d9d0
MD5 dfb2d58ae562eb65f4571d7098a6088f
BLAKE2b-256 55744eac7f2ec5b956694bfc0fedd42c85140616e36d4752272ce2919d02900c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7496ea5fe09911c83a81f8d787305cdc13b34769840af4743eb40daf5af838fe
MD5 b7a76c07e06646277158e76f69221c64
BLAKE2b-256 a7d222349625d2b4e43bd0597abe81e343a7a34288b28101a12e2af9f1e9f77e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1d9f42c2414cdba84e5bcc57e4963b5243cad55885671d6446957d26d9d0297d
MD5 71f04e9ec78a6da3c9bf5c714e776b74
BLAKE2b-256 93147e56690faada2dad762f826d876baf375c3454fb1a772ddc2627aa675e10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2bd941ba000e85015d2e20b19a74245373ad2dc4d3e62dc83a83a61a2643e70b
MD5 999296f55f037b33a66ddfc9955ace4c
BLAKE2b-256 5617a8e7f9df787a6ad0d7d8f085e75a585f13180f99eebfaa2643fe47c8ad79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f49ea6b7ce9693dfdf84b6023ce451675eeece2c4f042da2ab7095f1adbcf78c
MD5 0ca034565e92f9e68d68a8865cc8dd45
BLAKE2b-256 39c297a16be650da00ada11d2c283dee1f53cd21ff82ddc43ebd6f05da4dfb7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224200-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 12e195c853cbfed3190eab538ad97e0113d2b8c8ed336e3e5255bc00229dc74c
MD5 11151f9233c27df8f5865d3dedc48aef
BLAKE2b-256 2e4893886a9783a5d3a604559f03b4709695f9549a7043fc4e063ecb49134a1b

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