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.2023.3000.tar.gz (129.5 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.2023.3000-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (697.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.2023.3000-cp311-cp311-macosx_11_0_arm64.whl (507.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-25.2023.3000-cp311-cp311-macosx_10_9_x86_64.whl (528.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-25.2023.3000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (693.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.2023.3000-cp310-cp310-macosx_11_0_arm64.whl (505.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.2023.3000-cp310-cp310-macosx_10_9_x86_64.whl (527.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-25.2023.3000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (701.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.2023.3000-cp39-cp39-macosx_11_0_arm64.whl (506.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.2023.3000-cp39-cp39-macosx_10_9_x86_64.whl (527.3 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-25.2023.3000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (692.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.2023.3000-cp38-cp38-macosx_11_0_arm64.whl (505.7 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.2023.3000-cp38-cp38-macosx_10_9_x86_64.whl (527.1 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-25.2023.3000.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-25.2023.3000.tar.gz
  • Upload date:
  • Size: 129.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for lsst-sphgeom-25.2023.3000.tar.gz
Algorithm Hash digest
SHA256 f5dd149115bc4be2ed7588281892292a132336900c1ecebf3fa9590642e436c0
MD5 1f499f9dbc8d20027d0021018718e59e
BLAKE2b-256 eb1636b9f8e20a06bbe04ecff483e0b2dedfc6c79c251d327157f1ab22bd7347

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 350b53ef7366de4cd3594cecb4f800446f5074d3a3c5db1018031928a6b8ad29
MD5 f22ead21580b574b8e974ce78726fd97
BLAKE2b-256 3fafb47d5b371e5dcd67df95668e10f0cbefdc114f2f9dc87fb02dc07fc9d973

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 52c7f1a1d0152af1c65ff93310698371c44c2598181c296270f31656b94b7b81
MD5 7deb19f5e33d233d37a524860eb56615
BLAKE2b-256 5ecd03174682356c18614d0aac3d9e14d911d7779ca5061db00f6235c07d2c9b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 38e898261af6a698e5d3cc38cd19af93d44896a9d6f529b46ac18cf0bad2f539
MD5 dae88ad4daa3190444b1a7052142aafd
BLAKE2b-256 93ce946714c65ab5d5d0b988627ef9425eb6dec3e15db697df5c24692cca2f9c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3374f9bb0cb7c67a74f57bad32ea2c08425b41723af2794c60dd46789660f8f
MD5 a6893e372d5444892891497ecb57faf9
BLAKE2b-256 87b7c32ce30ae60409e6173b04bc95e5f52c0e590cc16edf4740f299f81ec25c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9fc0dc4ea325c83fa84560390975d70c3f1e0174ca99d2c6c5ec9a7048a4f4e
MD5 897559c561b5db078599fa1b1a4dff0a
BLAKE2b-256 440d08a4756590d1bb12bb983a91be0309b5bd8fc241acfea2274c0c4bbf1392

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1d2cd5498a3990b8e3115ed6a90acbcf35788f39f136f360eff3bd17c4acb5cc
MD5 74f829288fe4dd6e63acb32ca660df90
BLAKE2b-256 fa24d21e97133535b7219aeff2507423aeb9f29b0973ca0e8554d360bce8f9d0

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cb17a0a12860d33dc6f3f2fbef425fdf43ee384d249230991db3fb1487bbab18
MD5 d3745ccaf2e0f9cf9614c1c18df0b2f1
BLAKE2b-256 26ba347dbb5d370453aa11714d19634f0d22404c4614ea98922b910b24a3d3a1

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4623bd67d1e00c5084c80e1d8b79591982f3dce4848b04981c97b5d0acb94715
MD5 df0c13b97dc23230f307003931afcfae
BLAKE2b-256 9b9d6aff571d51841b77236988f7871f98f607375102b27f981a1dd975e867e4

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7114aa7f1fae0428030e16f8ef4d989c30e4bd6659b57d8e9f8f9499df8466e0
MD5 b00b3bfb8b162972089db720aead7cd9
BLAKE2b-256 7b215ecbe647c5cef38690de7c1b31aed0fbda46f7b8ec3ffb8f91cc52408db7

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a6087ac1935f2898be35d0d4d73b55a7ca3dd8a7def577e672f9838f02f7b27f
MD5 b7a97c64ef6e87a252e0d72377f2ceb2
BLAKE2b-256 7c3f682e0bbc82228d36ffa915b52f8e05ca813de600d1c0d2ded62bb0d2156a

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ceec7db80fc378643b5e054a245d2d6b4ea071bc7e0b61cb7465f6934cf22b74
MD5 204b0d7b1a4cc4bdbcda9f3d7f3e68d4
BLAKE2b-256 56f15d4ec6a423c2d5a7c57e8e70164c19495aad0a1eea26eecdb7b10294c48d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.2023.3000-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.2023.3000-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9e13e6eb03121709a06ca1d6cfe69091f80f819f4e1b442708935c983d4b2f82
MD5 af1a7b5a3e0c6fcd6ae8dd0a1022af87
BLAKE2b-256 b6f00f5dbfeba681a8b7007252312f4ed508737113e3f0e0c4785da0ca215901

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