Skip to main content

H3 geospatial indexing functions for Daft

Project description

daft-h3

CI PyPI Latest Tag

Native H3 geospatial indexing functions for Daft.

Installation

pip install daft-h3

Usage

import daft
import daft_h3
from daft import col

daft.load_extension(daft_h3)

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"))
df = df.select(daft_h3.h3_cell_to_str(col("cell")).alias("hex"))
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.

h3_cell_to_str also accepts a list column of cells and returns List(Utf8), so you can compute in UInt64 and persist as strings (useful for Iceberg/Trino/Spark, which lack unsigned types and will reinterpret UInt64 cell IDs as negative signed values):

df = df.select(
    h3_cell_to_str(h3_grid_disk(col("cell"), 1)).alias("neighbors_hex")
)

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 or List of cells (UInt64 or Utf8) Utf8 or List(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
h3_grid_disk cell (UInt64 or Utf8), k (≥ 0) List(UInt64 or Utf8)
h3_grid_ring cell (UInt64 or Utf8), k (≥ 0) List(UInt64 or Utf8)

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 develop        # Install the extension in editable mode (uv pip install -e)
make check          # Fast Rust type-check (cargo check)
make build          # Release build (cargo build --release)
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.2.0.tar.gz (64.6 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.2.0-cp313-cp313-manylinux_2_28_x86_64.whl (527.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

daft_h3-0.2.0-cp313-cp313-manylinux_2_28_aarch64.whl (507.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

daft_h3-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (463.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

daft_h3-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl (500.9 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

daft_h3-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl (527.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

daft_h3-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl (507.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

daft_h3-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (463.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

daft_h3-0.2.0-cp312-cp312-macosx_10_13_x86_64.whl (500.9 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

daft_h3-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (527.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

daft_h3-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl (507.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

daft_h3-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (463.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

daft_h3-0.2.0-cp311-cp311-macosx_10_13_x86_64.whl (500.9 kB view details)

Uploaded CPython 3.11macOS 10.13+ x86-64

daft_h3-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (527.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

daft_h3-0.2.0-cp310-cp310-manylinux_2_28_aarch64.whl (507.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

daft_h3-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (463.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

daft_h3-0.2.0-cp310-cp310-macosx_10_13_x86_64.whl (500.9 kB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: daft_h3-0.2.0.tar.gz
  • Upload date:
  • Size: 64.6 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.2.0.tar.gz
Algorithm Hash digest
SHA256 526c29000a2a5be6cd78560e0a51b20161b8c071b8a35ccb9f6bdee6a0f438b8
MD5 735658cd2dbdf5de407593bbc6e4e189
BLAKE2b-256 c0948debcf6752130adaf576dae32f369d2edf40c0c0e81f6d89a4be7ed3f57d

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bf34fcdeee45735953c21a83bbeac3707ed41e0cd1d430334e324ec367ec2560
MD5 f96b6893105948aae2865f89c1e5416d
BLAKE2b-256 7132d44e766ae1d16f86894f44a43039fc946587a2edc3a61fa5dd98ff3de3f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e151ba9fc472ea4deb6fad34abaf0d28f0b6f14c445ecc4a2d244130911cbe67
MD5 226d45b9adf0163455b033f1922b30e4
BLAKE2b-256 e1360276c4dcd0f08b974d163978327d7d227f5791f9f459f7492445124e65b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e4105580652a835d856be18f03942f4e176e1a8ea56408b5192eebcf02f8223
MD5 4871bbb0a6121c40f5d424a3e9987a1b
BLAKE2b-256 ee05e623213073471cb016e5814886d1d6cffa356905e616e3eda52368f9079d

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7d02cf0f9113ccc3b011140e44f5c0821ea0d8625de943b925ca1d5fac0fef33
MD5 fc3a5c435f617c4984669ef2a442ac7c
BLAKE2b-256 336c4f504c56128da9643c6ed296a566f0efa0919e321346d5a18144ba5ccf3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b098a87818ec51e69a10e97ac1340356ab1f35ca7725c32dd9dd2bedab92fed
MD5 7bead5cd9c2a52eec3cc9e8829ae725f
BLAKE2b-256 b505756778e4b2e632c4970c2cd9e42cb08942de7b0df43fd39398cb3dda3506

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 40aebb2797cdbd51334c9c03343c58b549d3caba20c34ac018771b62d54cae46
MD5 ecb20511bceca7a371b106299a1396de
BLAKE2b-256 b3489e11eb7ce6ef5e327795d9e4000d0aab783ad6f3f2c88c709521ef1e2547

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff10070e00a6cce1a4b5dc69129bc2f66be2a6cef7be5d3598c18bac2db26d54
MD5 1ec1764b9f9eee77745fc0faa16e1647
BLAKE2b-256 c26b24ed4706e07d37d66fe56a464666c019c2afb54b91b8d2f1538dcadf82b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 00b8a095384409433f89186ea33994fa5124e574ee63a19d253eba5f78b6f7d3
MD5 5f0f46c20f76cb8f42f3e72db30e181e
BLAKE2b-256 3d5418c2e37246cd0fab125cf8df054a8d3cba6caa37327756a9473d04c7fa98

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7609c8bab2f76d854738b5228e49e410a06d6c3d8a2b25500fda9f8735a0f394
MD5 1f32278498d54a0049ef2472f4dca4d3
BLAKE2b-256 af80088c1c93eafdbf5d9c7ed5fdd5b9bd198ba9036aa062c9641c6da42727cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 84ad43f34da682f383dc4dd2cab9b40944375d4cef08393877186f0964f7fe16
MD5 a036846305ff10cf0063a279c03a6b35
BLAKE2b-256 75616e81df41dd980e170f1563a1b7ddc75571f3654da7b3a368cdaccca70e4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b39a1e7aa95ef63d061dfcadd019f94dc410f1b56697956fc49fc505d35626b4
MD5 1ee160a48207f240bb27dcb9010299c3
BLAKE2b-256 9bb186d4f1c6b6716bb94b8fd1455edeb783919be562168e53fbf350aa25e285

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp311-cp311-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e82d70189ba59d5fb0c086a1f7ee60efe2bf80320e381b9d1bfbed5608e49d15
MD5 dd6228b4532e887a2896345903ec03ec
BLAKE2b-256 4d03fb426232f397d9aa9bb922554445bfccd31d89f32d481d56bbbfb67264bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0eb9c5adb66c2e8eb04707b1bd0efa1df6e3a62c663f7f0462ad3ed93e65f82b
MD5 f45078dd002de12899f5c8be9196ccbd
BLAKE2b-256 135a91553e1a0c806cfa5326a96e3dcf3c5db4f75141a29b308a54135f4fbb84

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c53e9a8a0d1da202ff393f9ce50b25e465e27bf515177a3ac313d51679c4f12a
MD5 ea91740781ec9ab03a30aadc12af0d0e
BLAKE2b-256 386fe9ddfb2d194c069df90b7eef748cfc5f887b0230b451b7d76221b2f97bb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 118e4ed41694fab79a6c64d641530bce73e2434ffcb56192b311fade11e76924
MD5 834fbe79be19b80776bb5e2d530504a4
BLAKE2b-256 7952a2b6a8cda88f6f5f07d53b85eaa86f902a135e3244d6b901c6a3e655c616

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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.2.0-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for daft_h3-0.2.0-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 867c5d3e45aba7fd87f280a1ce9cd1b8ae3c94a80dd166d937d896617df226b0
MD5 2d034fc72a10b17cab2818c88dc3ccc1
BLAKE2b-256 21e307539f3dc4b32f94f6c826a1eba92ab19392a367c0d8385e3e5eeb204d2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for daft_h3-0.2.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