Skip to main content

H3 geospatial indexing functions for Daft

Project description

daft-h3

Native H3 geospatial indexing functions for Daft.

Installation

pip install daft-h3

Usage

import daft
import daft_h3
from daft import col
from daft.session import Session

sess = Session()
sess.load_extension(daft_h3)

with sess:
    df = daft.from_pydict({"lat": [37.7749, 48.8566], "lng": [-122.4194, 2.3522]})
    df = df.select(daft_h3.h3_latlng_to_cell(col("lat"), col("lng"), 7).alias("cell")).collect()
    df = df.select(daft_h3.h3_cell_to_str(col("cell")).alias("hex")).collect()
    df.show()

All cell-input functions accept both UInt64 and Utf8 (hex string) columns, so you can operate directly on string H3 data without an explicit conversion step. Functions that return cell indices preserve the input type: string in, string out.

For maximum throughput, convert to UInt64 once at the top of a pipeline with h3_str_to_cell and operate on integers throughout.

Functions

Function Input Output
h3_latlng_to_cell lat (f64), lng (f64), resolution (0-15) UInt64
h3_cell_to_lat cell (UInt64 or Utf8) Float64
h3_cell_to_lng cell (UInt64 or Utf8) Float64
h3_cell_to_str cell (UInt64 or Utf8) Utf8
h3_str_to_cell hex (Utf8) UInt64
h3_cell_resolution cell (UInt64 or Utf8) UInt8
h3_cell_is_valid cell (UInt64 or Utf8) Boolean
h3_cell_parent cell (UInt64 or Utf8), resolution (0-15) same as input
h3_grid_distance a (UInt64 or Utf8), b (UInt64 or Utf8) Int32

Invalid cell indices produce null. Resolution is validated at plan time.

Performance

Benchmarked against wrapping the h3 Python library in a @daft.func.batch UDF (1M rows, hex string columns, Apple M-series):

Function daft-h3 UDF (h3-py) Speedup
latlng_to_cell 416ms 1,407ms 3.4x
cell_to_lat 242ms 1,011ms 4.2x
cell_parent 75ms 1,072ms 14.4x
cell_resolution 47ms 767ms 16.4x
str_to_cell 46ms 756ms 16.6x

Development

git clone https://github.com/gweaverbiodev/daft-h3.git
cd daft-h3
uv sync --extra dev --extra test
make install-hooks

Requires Rust (stable), Python >= 3.10, and uv.

make install-hooks  # Install pre-commit git hooks
make lint           # Check formatting and types
make format         # Auto-fix and format
make test           # Run tests

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

daft_h3-0.1.0.tar.gz (60.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

daft_h3-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl (501.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

daft_h3-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl (481.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

daft_h3-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (440.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

daft_h3-0.1.0-cp313-cp313-macosx_10_13_x86_64.whl (476.4 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

daft_h3-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (501.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

daft_h3-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl (481.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

daft_h3-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (440.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

daft_h3-0.1.0-cp312-cp312-macosx_10_13_x86_64.whl (476.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

daft_h3-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (501.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

daft_h3-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl (481.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

daft_h3-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (440.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

daft_h3-0.1.0-cp311-cp311-macosx_10_13_x86_64.whl (476.4 kB view details)

Uploaded CPython 3.11macOS 10.13+ x86-64

daft_h3-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (501.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

daft_h3-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl (481.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

daft_h3-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (440.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

daft_h3-0.1.0-cp310-cp310-macosx_10_13_x86_64.whl (476.4 kB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file daft_h3-0.1.0.tar.gz.

File metadata

  • Download URL: daft_h3-0.1.0.tar.gz
  • Upload date:
  • Size: 60.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for daft_h3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d19f244cf55d4568772a05c119a475538c1adfbee56e84aa681d70c7e92c10f
MD5 599d4e6c507f60f01a053e51f79c0d9d
BLAKE2b-256 31f552c7e50a9d800388c24b8743ed7869c560b4b59d298deb622634d3c7e35c

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0.tar.gz:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 434b68c53feb270542314424845c2fc6c87983b8aae35edc777b748ab5f475e9
MD5 2a21acceafb203f8d3ea88faa2815d9d
BLAKE2b-256 6822dfcfa8eeafeb32b8387b101069146ead2e623c5371637eda7e0799fd3133

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 78d8b90224c004bc6c43fead798b0fe2623d8c61e04a4025ca5acd138ff55e0c
MD5 df4981950f9da602c886a4da27e49af8
BLAKE2b-256 58562188f2ac989df909a48772862143f481acb1c61eba9475045505551efe9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee69e2bf8ad67da55409e5eb0bd6f5dfd55e0d7bacd6535007703b2c40c9463d
MD5 5359fd1f7d5684b27363adaa52a867d0
BLAKE2b-256 1d595ea2213721799e3a5e5181c2943c43ffa70c7dc355f9af502dc356981faa

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 422919f7d5120cfa0804081951ea1fce8c1bdd3679c8a50c09c27abea6b71ca9
MD5 83bbaea4a67dc4691ffd79100dfa9f88
BLAKE2b-256 217f4b962128c793af67a1d3571d427eb2e7ca8c44d3d25797140fec619ec047

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp313-cp313-macosx_10_13_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 771c9604bc5a2c040c7611d0a40c466047052c4479882e691043a634766ed548
MD5 f7094749bea8ced1ae94bc5a2ac11931
BLAKE2b-256 0cd9390c6a1e84588f5a60c6976f7adbba484d5f5adbae906a2014246dd80d7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f3d5920bca716e326f6e60c6c52c2ab082139491c55e3bb2a143507d29be924a
MD5 5c385de7cddf7df2d2c413214aa63aad
BLAKE2b-256 f37ccd4c34481e135d92b81389821a7e8199fafcde01be016756b8ab029398dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 588e53afcdcc41e14d3808194ad740674d56f188eaa52f0f012eea486b289394
MD5 ff01b887618f1350d45fec7278c03c74
BLAKE2b-256 5d0ec1d83abdad3280790614b931d35269c49c0a6ddd5b4bd55684c7dd94c9e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 291ddbb34c5fb92df4c2fddc64f91832459c6ad6a8faaa94b9ce8a71352124f0
MD5 af51ca0a097b2ade2e680a3f2aebd728
BLAKE2b-256 08905d07d9ccfe0428dc9b40c018d8c561342bacd474ffe7af5cac0a7bb309de

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 48877b3cb6a17cebe80cd9eae5ac5b92d545bed9ddb15e271552b1d2ab5a9609
MD5 aed59ad43293524c8ce41d8adcc64bde
BLAKE2b-256 dbcbc4dbee2c9ddba9a2914d380526719124a11ff27fce3cefeab55d4f9aa952

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 78e6a4d382daa070cd691a6b4517278f4d16edfa28300f2517244a458769e90c
MD5 f07ca1fb39c29cf0f1fbec0cffe4796a
BLAKE2b-256 a6b8052148a7b3f0f2d463f73dfe01c06e5543772df8acdf6ad4f94c5a8f560f

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98bcc4d8e22461615848689d44e628582c157ef4a71d1f47cc4cef2c860e545b
MD5 5281c4b19de05893b49a1435c0e5e17a
BLAKE2b-256 d6e85a602edef3fca83a74061f25690b5a17743ab66e91a6c758a8316ecd7654

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp311-cp311-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ce5b0b66db23096abe8989fddc35112eeaf5039333efeabdfed677280035d1cf
MD5 41e6c9facb4fe8c462973133513443fc
BLAKE2b-256 ad4558b7ec1559b9e5a77ed716d180dd6b74b6d029945855d4a6717b833999c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp311-cp311-macosx_10_13_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 00aa549bd7cc8dd7d7928b1a3c8730a15106710450f111cd3b974f2e0be88e6e
MD5 fbfd602ab7e27d54cda60eb428d825d4
BLAKE2b-256 137a7d127e708c6240e4b9e4fbd467b7716ff4e9056ecb78b9019d99cd8d2a01

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2e134432c7cafd10f78d4eeb13df37fe92eca26b85de7bba0b520b63fb276d59
MD5 da582b3ea5526e789582fdaa048e5e3f
BLAKE2b-256 5cc54854ee1c4f596ae46e149875bb7ae5e33db5dfbcf576ed51ee1af68b47a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2857e71bf8aa21135c758e6e66aef7192bd3eaf45956e74a88cde476dea720a0
MD5 512742e21da36ec61890975fe23349e7
BLAKE2b-256 83dd42d02b6002ab30e2502389f0c55434ab63847e630b3d4513082c2bb00a09

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daft_h3-0.1.0-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.1.0-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 fe33e45b59e9240b34dcd83231afc8b0fbb7f6cb2413c641d6eb958ff9b1d4c1
MD5 f44c1af54734207abaa69eee7a0f267d
BLAKE2b-256 3f88fac886918e1c3cf5794befc0a8de04ed23ddcbb53698e2ab7220e6e14860

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.1.0-cp310-cp310-macosx_10_13_x86_64.whl:

Publisher: publish-package.yml on gweaverbiodev/daft-h3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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