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-30.0.8rc2.tar.gz (162.8 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-30.0.8rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.8rc2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.7 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.8rc2-cp314-cp314-macosx_11_0_arm64.whl (602.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc2-cp314-cp314-macosx_10_15_x86_64.whl (629.4 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

lsst_sphgeom-30.0.8rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (884.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.8rc2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.8rc2-cp313-cp313-macosx_11_0_arm64.whl (600.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc2-cp313-cp313-macosx_10_13_x86_64.whl (631.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lsst_sphgeom-30.0.8rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.8rc2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (828.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.8rc2-cp312-cp312-macosx_11_0_arm64.whl (600.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc2-cp312-cp312-macosx_10_13_x86_64.whl (631.0 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lsst_sphgeom-30.0.8rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (886.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.8rc2-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (829.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.8rc2-cp311-cp311-macosx_11_0_arm64.whl (594.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc2-cp311-cp311-macosx_10_9_x86_64.whl (618.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-30.0.8rc2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (885.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

lsst_sphgeom-30.0.8rc2-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (831.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

lsst_sphgeom-30.0.8rc2-cp310-cp310-macosx_11_0_arm64.whl (593.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-30.0.8rc2-cp310-cp310-macosx_10_9_x86_64.whl (616.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file lsst_sphgeom-30.0.8rc2.tar.gz.

File metadata

  • Download URL: lsst_sphgeom-30.0.8rc2.tar.gz
  • Upload date:
  • Size: 162.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lsst_sphgeom-30.0.8rc2.tar.gz
Algorithm Hash digest
SHA256 33595d2713b70bca42f8c794b2d8e3d3aa5dfeda48d73fca3c5af6aafa3c02c3
MD5 35eedf946aa7b891357305d3ac13d3f4
BLAKE2b-256 8c372f40135a472d20c03e20a02e6c3b1427d63d910aa5e4183266be2c98f99b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 15afe173b88f1f5137c488173ccbb32503afa982fede087dd866e623774a12a7
MD5 2ef488bef8e6c59e35b654e5d5baa5ea
BLAKE2b-256 813099255acc7c729d6e8fb737567392c197e72b6ed458c6ceaa37f62d40cce3

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 20c8f3c4d655ea055a7ea1f2c280144a6014621d61789cc3d6efe5238828369d
MD5 c5a7653d69472a7c82c2daa332088ead
BLAKE2b-256 62fab89982489ce2dca5ff3f0881911fbe4c6ffcab61ff1e23b2128d2a0496cb

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b31b174179120c9f21ca85f4a669a14deb9b7c4e509bf39037d31c370b75347d
MD5 f10a8b2cdfbc544b8a2f478249c91973
BLAKE2b-256 3b116e82eea825c2808effb53d226f4605ef8ab170d2f350fbea457fe0b98145

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 975b0afc822527c6fd8cec643277a1a88df868e446983b5e0d319b6a146408d4
MD5 ad14ad9c5184781677dda2b6c7707157
BLAKE2b-256 6719ab52788209f0986f171dba6a75792786612b94bb9a8d7044c521a2bb8e0b

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb4ccbf6ae5d66dc755bbba55795459de696c1b376b952d5db5af911790b2c2c
MD5 cd7b874ac2a63d327afd7ba6a3457133
BLAKE2b-256 24c3cafbeb3144698bebcf3fdf84d420d2e4407adf5b3e963e2aeb93b83eb5bd

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7fc5960e637eeac02147f5e3eb6dd71d3f7dc627eebf9efdb72e67858d5a8fe7
MD5 a30fc605418d3e72a53ca239a18b465e
BLAKE2b-256 5f4e983e9832ffcd1bed8062f058c177e9baf2dd43b1dbe6d70f9a081ef9a07c

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80720ab6a1de027cfaf54d606ce20c507225f88512bcd079c05743cddb3187e3
MD5 26b67b54c44f4e28916aa67278b83435
BLAKE2b-256 d92064c94bbffc7f88b6aed9309d864d2843487fb015b5869747ae3ef93ae3d0

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7e3c96c976b69a52718dd1cf99a754b89427aa4d215da71e08f1e08c01190c6b
MD5 ee0e2d19296173a996290bc6a3176300
BLAKE2b-256 98544c6af73a685d2622eb1397add18f21fb6c321e9ab5bf7c84976505c083d7

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2af38b8bafafa73c83f4d40704dae31434f4b7aeaec0af926d32f9af14e04c22
MD5 db195b891e11a5510c7a545a8761c498
BLAKE2b-256 bd151045659809a1dc9228be137377447ed8e4c252026a358fbd2c6e343f2447

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4fa5efc9dd2578d4129d25c922ce8c884329a3c131516bd09823350795eef575
MD5 96dd4b35ff03de9b692925f8d67cff47
BLAKE2b-256 10d1532a9df2a934bf436d1b87e742f55f1a8584b62ac6446cd96d64edde1cef

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c2fdd51d54216b4c1a20f7ffb14d22567b9d9dcc4a2fa7dd4399824a20e73740
MD5 6092161cd091ca5261da675501cb2fbb
BLAKE2b-256 461b55e8caef473e5142003afa622cc3b94c2d847f074ba3f971987a530a2bfe

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3d2e24e961d95a3a8b81af07f01c602e540f091ca5a0d86ab1491c12364274ee
MD5 ec0c3ab3ac5d37a694630895bf9f0160
BLAKE2b-256 f46f4e2d9adc144557b19583482f0d7c1c1f3268c1415c2df0294203cefabf01

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1383e8b0ae2193cf30fa270115e92fa9f659dca4ce2c2a0003b829a39745ccf3
MD5 17090214881dc65d08d7179b9c13231d
BLAKE2b-256 688b403b6c905dc6f6eba960969f50745761c6e68aa925c7a2bca044ceffca3e

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 68ff460dcfae0a93503b8e57837ecdb3a802df4688a496bc6b0ebbb75c80066c
MD5 6c40254f89a3e4a886989b866536bd13
BLAKE2b-256 a9b0b908a434523f9a7178dc3ddbad69f17b97ad15ed553a5ecee635eb707f16

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f94cdf25fdab35fd2278c7ecea46b68c6690951af6b26b1cae0936f60d7773e
MD5 a260a3380e7865a9a184960efffcd0d7
BLAKE2b-256 4162fd279f0f0e47a6999e883840efd60935db4ad886819e5b0ed5064f4e81c4

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6b598c0cd7975b117b27954702b328800792190dae34ac0fe4f596503b1cb5bf
MD5 716267610c4e6e9389cf9c778c6f81ae
BLAKE2b-256 f4e5d9ac91d320d08e197697b73ee105bfe36b2f764238b6166d44e596f038d6

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3d75bcac779534436e80a9f4ec92103a7c91bfaa05a71d54a340bcb4f20641db
MD5 08e9be7c1c8c5eca21635da434d4465a
BLAKE2b-256 2a4b471aa8e1838fb37e562b966a7227847f4418a74f7278a051245c22dd0854

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a7a2d4a9547de3a2db73a771724de796f009b02738a4615f69cbae9cb19b1cda
MD5 f3e43984bde2b5aecef3474d16d3fd6f
BLAKE2b-256 50e681492042fb5a820b84ce77bfca8839f00edb504d3bb628701e05b14eb29d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 300a97c06686946bc1540921528069e7a9c50ead969e0842b85438579c3ca58b
MD5 cf255daa1edfc5b96d684fc7d9644e05
BLAKE2b-256 b815d5b92894f28411cca644c546572b234b08700f0bb9e9e646fb8d049eef75

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-30.0.8rc2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-30.0.8rc2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 19e7b4663d1cfdf943cd4ca7c8d0b8717dcbb5eed6247abaf28220da620d7322
MD5 ac5f6699a09bc26fc9ebce5d88999aef
BLAKE2b-256 75440eb632a17280d1cc14615b4eb03e84dab41f2d57d20d76fc9c51560579e9

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