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-26.0.2rc1.tar.gz (129.4 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-26.0.2rc1-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-26.0.2rc1-cp311-cp311-macosx_11_0_arm64.whl (507.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-26.0.2rc1-cp311-cp311-macosx_10_9_x86_64.whl (528.7 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-26.0.2rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (693.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.2rc1-cp310-cp310-macosx_11_0_arm64.whl (506.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-26.0.2rc1-cp310-cp310-macosx_10_9_x86_64.whl (527.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-26.0.2rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (701.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.2rc1-cp39-cp39-macosx_11_0_arm64.whl (506.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-26.0.2rc1-cp39-cp39-macosx_10_9_x86_64.whl (527.6 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-26.0.2rc1-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-26.0.2rc1-cp38-cp38-macosx_11_0_arm64.whl (506.0 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-26.0.2rc1-cp38-cp38-macosx_10_9_x86_64.whl (527.4 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-26.0.2rc1.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-26.0.2rc1.tar.gz
  • Upload date:
  • Size: 129.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for lsst-sphgeom-26.0.2rc1.tar.gz
Algorithm Hash digest
SHA256 398bb655c585b132f5d653d07209de5343561708098eb83e5aa90270c67d902a
MD5 d3d47665fba47ed747e23d22990d83ab
BLAKE2b-256 f2955229f4ba35550cbd5f68777b0ac3d20736f496546c3ec6bf04dddf2879da

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bbfc2bb9f97f6ffb60018f36a554bb063bb8a8a1e9c51ec73e277d952d6a2d9a
MD5 86c3795425cc4359d6fffde585ab4e26
BLAKE2b-256 1da37232a252cbe10573278d7454cd1aa64d11b1b3cd74d9f2dc9e1354ac9dd8

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95cd71b025320e2e49e6e72234acb2d726340c5d4defb71306e00038374c2423
MD5 e25affc89321c2af3a4f0cbf8652d350
BLAKE2b-256 128a378c4e9a94aa379a4692cac0045111401b2e3a01c98db3587af4ed1563fe

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d1316756076e60b77f36f5a97c27fe223d0ef0d5abd733f5f236ca77db7f4dee
MD5 e1b1d2db8ce6803d166a00943c25e6bf
BLAKE2b-256 1d40707aa0880149587207325a2a8f0ce36baa938266195ecfa6509ea9e30d8c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb096da6b725d90396f9cddcfedd80b22afe0a30db0d196123690a1cada516ed
MD5 16119e18dbe0dea3c2ed76ac7699109b
BLAKE2b-256 480df2cb6c13aa3d092ce33455c3b42c5fc752f8ef6286eb867d46f0b4280498

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a711d715de4a35dc3e328097f3a4d12d216e052e08c24a1e5709eee9df8c234a
MD5 342b8565c21ce857bee996851ca07f24
BLAKE2b-256 422299b35208e79b588ce6651735fb4d090c091bb9408aef5278815d97149c89

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6c04413f39c18c7fd069baf6fc6f8da41f0d66f5ca7f9a98ead86090b0252ad1
MD5 81d100c0a4dc7dae036a4e8585be5ce5
BLAKE2b-256 6c574e3c5a57437bf3b9a2e63849f8dff06b02b1715df2062d5583c763b965dc

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a4771bbb4b5a296c79b34d954c49ab48deab843733862d5ad83b2081771ef868
MD5 96e17bb0f77ba8fc90988459e0ca23f9
BLAKE2b-256 77e03d4cf173edd17e5808f3c42151ba8dac1f7878a7b3b908c1b013e6d6f920

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49f6aae9d836bf250fa7d084a59b7beeecc18d6c9110236e7e6e115e4b222a01
MD5 44260ea05e2a94146e63d071fc729dac
BLAKE2b-256 1e2b211469059adb072aa3069bd84904a7c8302d1c8af96e1ce8bc490e8fa617

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 481d58e3bbaa0d7be4cdaba092c5484a374cec0cb76574f2669c4a24615b172f
MD5 089aac10e0c383ea68e378538afbf0d5
BLAKE2b-256 f90d784b2724650a64915a5634800a20813a5a41dbc02897f2795e478ad2c160

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb29511c87a7d77aa2aea3da21bd9ca40c75168a52a056cb59de5b66183e7f9a
MD5 d7c563e048ef18020d54c706de2f30e9
BLAKE2b-256 5bb7980c1cf9ae458fe6b4c6175f483da48ced44c729e8bbbf913b9277a13364

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70dcd859327a22941e1453cd67c632e35ce3ecad9dc3cf707e833876b50d280b
MD5 fb36522ac922cb3187403ccfdad057ba
BLAKE2b-256 80fe7990b410d34d07cb3f126744b7e6b3e95db17af94d9a6e80de4b33a85858

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.2rc1-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.2rc1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bc47f9922560a434b8a8a8cf090ec0a58520e0a0e3ab4d816e2ca7b4ee588164
MD5 cf372c0b8dc389cb320c9948433be012
BLAKE2b-256 4a3e72726c631281a11167709ff14f262c144a2fb1ef731fba0f28f1eec64939

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