Skip to main content

Objects for DGGS Cells and collections of Cells.

Project description

rHEALPix DGGS Simple Feature functions

This library contains functions for evaluating Simple Feature relations between DGGS Cells and sets of these. A wrapped version of this library is available as an RDFLib extension for GeoSPARQL queries: geosparql-dggs.

Installation

Using PIP:
pip install rhealpix-sf

This package depends on the rhealpix-geo package to represent valid sets of Cells, and perform low level operations required to implement these functions.

Use

These functions are implemented in the file rhealsf/dggs_functions.py

This means they can be used like this (full working script):

from rhealsf import sfContains, sfEquals, sfDisjoint, sfOverlaps, sfWithin, sfTouches, sfIntersects

a = "R1"
b = "R11"
c = "R2"
d = "R1 R2"
e = "R2 R3"

print(f"a contains b, expected True, returns: {sfContains(a, b)}")
print(f"b contains a, expected False, returns: {sfContains(b, a)}")
print(f"a equals a, expected True, returns: {sfEquals(a, a)}")
print(f"a equals b, expected False, returns: {sfEquals(a, b)}")
print(f"a disjoint b, expected False, returns: {sfDisjoint(a, b)}")
print(f"b disjoint c, expected True, returns: {sfDisjoint(b, c)}")
print(f"a overlaps d, expected False (within), returns: {sfOverlaps(a, d)}")
print(f"d overlaps e, expected True, returns: {sfOverlaps(d, e)}")
print(f"c within d, expected True, returns: {sfWithin(c, d)}")
print(f"d within c, expected False, returns: {sfWithin(d, c)}")
print(f"a touches b, expected False, returns: {sfTouches(a, b)}")
print(f"a touches c, expected True, returns: {sfTouches(a, c)}")
print(f"a intersects b, expected True, returns: {sfIntersects(a, b)}")
print(f"b intersects c, expected False, returns: {sfIntersects(b, c)}")

Function Definitions

sfEqual: Two sets of cells are equal if they have the same identifier.
sfWithin: One set of cells (A) is within some other set of cells (B) if the addition of A's cells to B results in a set of cells equal to B, where A is not equal to B.
sfContains: One set of cells (A) is contains some other set of cells (B) if the addition of A's cells to B results in a set of cells equal to A, where A is not equal to B.
sfIntersects: One set of cells (A) intersects some other set of cells (B) where they share any two cells, or any cell in A is the parent or child of a cell in B, or any cell in A or B touches.
sfTouches: One set of cells (A) touches some other set of cells (B) where the cells meet at an edge, or vertex.
sfDisjoint: One set of cells (A) is disjoint with some other set of cells (B) where they do not share any two cells, no cell in A is the parent or child of a cell in B, and no cells in A and B touch.
sfOverlaps: One set of cells (A) overlaps some other set of cells (B) where the addition of A's cells to B results in a set of cells different from A and B, and A and B are not disjoint and do not touch.

Testing

All tests are in tests/ and implemented using pytest.

There are sets of tests for each of the Simple Feature functions.

Contributing

Via GitHub, Issues & Pull Requests:

License

This code is licensed with the BSD 3-clause license as per LICENSE.

Citation

@software{https://github.com/surroundaustralia/rhealpix-sf,
  author = {{David Habgood}},
  title = {Simple Feature functions for rHEALPix DGGS},
  version = {0.0.1},
  date = {2021},
  url = {https://github.com/surroundaustralia/rhealpix-sf}
}

Contact

Creator & maintainer:
David Habgood
Application Architect
SURROUND Australia Pty Ltd
david.habgood@surroundaustrlaia.com

https://orcid.org/0000-0002-3322-1868

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rhealpix-sf-0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

rhealpix_sf-0.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file rhealpix-sf-0.2.tar.gz.

File metadata

  • Download URL: rhealpix-sf-0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for rhealpix-sf-0.2.tar.gz
Algorithm Hash digest
SHA256 7e2731b656c9b45cc7a33a7c8c45f75251947365b4a2336f0c439cb006e807d9
MD5 4da2316081019711eaf5312b93d064df
BLAKE2b-256 505b71b64ddec48b07a52480768a1f0e3337e155126e9cd4c31a09d294a3af62

See more details on using hashes here.

Provenance

File details

Details for the file rhealpix_sf-0.2-py3-none-any.whl.

File metadata

  • Download URL: rhealpix_sf-0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for rhealpix_sf-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89520ed307599f544188c9ec60560f852c77e664df30e4abc613d7b33ec7b0ef
MD5 d62a4713b9ec2de1ebe521e796795555
BLAKE2b-256 2b8d864625f9946416c800b4315db01f3b9a072f6d59992645703d9ac9978f8b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page