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.1rc2.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-26.0.1rc2-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.1rc2-cp311-cp311-macosx_11_0_arm64.whl (507.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lsst_sphgeom-26.0.1rc2-cp311-cp311-macosx_10_9_x86_64.whl (528.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lsst_sphgeom-26.0.1rc2-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.1rc2-cp310-cp310-macosx_11_0_arm64.whl (505.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-26.0.1rc2-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.1rc2-cp39-cp39-macosx_11_0_arm64.whl (505.9 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-26.0.1rc2-cp39-cp39-macosx_10_9_x86_64.whl (527.2 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-26.0.1rc2-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.1rc2-cp38-cp38-macosx_11_0_arm64.whl (505.7 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-26.0.1rc2-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-26.0.1rc2.tar.gz.

File metadata

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

File hashes

Hashes for lsst-sphgeom-26.0.1rc2.tar.gz
Algorithm Hash digest
SHA256 0716b1947ce892076039cd8e12523188539d36b0a2fa29b8d20ff454d15c0747
MD5 e8e3682d9e845dbdcc1e316b2f276c6b
BLAKE2b-256 efc68afe56379558c22c940561b2876ef2a751e270c25c06136d568a013c7ef2

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1acd4d0ea6edc2e54c5562d213d06208f595a8d03b3e1c5de20bd90611f5fb5f
MD5 b9e76f9d9c576db79b1b265ae0e673b3
BLAKE2b-256 f258e938915a56ebbd8fc2da24edc373df854e7a14312c3cd8d1933e5de5794a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d3ea6061b5f3d52bc7a99a58d66e5ffaa4825a01c0abccc2fe2d259b6bd9f2a
MD5 d70eff47d5ff82692315bf071b52f2b9
BLAKE2b-256 a39865d6e0409351600a08b8e371026338cfd5acb42de0376474ed6cb5de422a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1873dd916b96261cde0b0ec4a90d9a27d17b99bdbe314dea8f136f4c492dc179
MD5 3ea6e8a518bb24b09c98a1dffed6416c
BLAKE2b-256 0d55137b9f0d4b4e9f86941d1c9fb8e321f50ab4227283d633963501e29829a5

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74e79b21921f2acdb788c78dad9aeeb372eb10d79fc5db554a9a32a121e1e11c
MD5 37ccbfba53be24e7eeffcdb246efcf1f
BLAKE2b-256 b8c223b082a5d4faba50c667211d492eaa32f2bd9a589c6450f9bebb5a47b176

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 973a66c01a0561bce7f48db025ac9a5ad223b855685182bc27e412b7f9f9b6cc
MD5 df9cac85cf5214e2f79d5e200189665b
BLAKE2b-256 95e2ec35b539d2ac0730b98f18c5ddeb2813b218cd6afaf4d3bd83cc8124dc7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a729e4675fe3a76ac4b68720efbe0878e214a050d119704b126f0c58e7e1aa1e
MD5 ec09d57011dcbe3935fc795ae667be94
BLAKE2b-256 08292ecad3ab1aa95bea14ab3b841559501dff91c6640bde417b98c67d831ac4

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d52be7acc7f1fbd111544cfe4ee0c1c2620d2eec6b590fb19e4cb5e1f94cc58a
MD5 29b35676eeaefb825e3cdff48291203a
BLAKE2b-256 2270549b71454f4076949b0cce9071b972ae2656846594c10ff5fa3bc4ca3c21

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 109a6d96d9b69f8425db744b899cd47f4b553d599d86f4aaebd638a643739f5e
MD5 50545cd8f3a90a65873029a8b476b768
BLAKE2b-256 8820b5b85c07d493a67d2f295c5883ba27a4b653a7fc1e5704eb0f673012ac64

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 48e26f11632294a7306c9a4bd2b59cbb6213bd24c62bf6fec73a49c4d96c0b9f
MD5 9b863446e39463b2f12d686f474e6a65
BLAKE2b-256 775a39219bb43284340ead561d380901cc1b8363f15d2605cecfb879a4dbc295

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 502cb30afd80f30b1a27711411c5c9087ab11d8ac355edf3a641ce121c0ef738
MD5 01e397373b027232135c925e7b5582ea
BLAKE2b-256 345b8c4f322b667b0609777764f4138a54db93b40c0e236e6bd38097638592ed

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 21367941e82c61cb87fbbc71855ff375b1f1764cc307c100c12ea0689a5ea0e5
MD5 74e39e273d8adc42d04bf2c53dd89c47
BLAKE2b-256 bc36a078fabb79da274b1c33b1b14b4030c4d57ee8e48f839365c075ddb1d0de

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.1rc2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.1rc2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d825e6722f8dda132845decb942f390ef7e6dade6a4d4329b8d6049e0d84198
MD5 52c3062504f6ddc1db47ccd67af12868
BLAKE2b-256 c198f4ff7b7fc5a73505809cde9e54553bb0050533c9c9d7c0ca27f637aa636f

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