h3-pyspark
PySpark bindings for H3, a hierarchical hexagonal geospatial indexing system
What it is and what it does
h3-pyspark wraps Uber's H3 hierarchical hexagonal indexing system for use in PySpark DataFrames, enabling you to convert latitude/longitude coordinates into H3 cell identifiers and index complex geometries (points, polygons, multipolygons) as sets of H3 cells at a chosen resolution. It extends the vanilla H3 library with PySpark-native operations for spatial indexing, k-ring buffering, and spatial joins—allowing you to bucket and cluster geometries efficiently across a distributed cluster.
The package assumes GeoJSON representation of geometries and H3 cells as string columns, making it a natural fit for pipelines that already work with GeoJSON. It is most useful for approximate spatial joins and distance-based bucketing, though results are candidates rather than exact matches and should be validated with a secondary distance check if precision is required.
Use it for:
- Index geographic features (buildings, roads, regions) into H3 cells for distributed spatial bucketing and clustering.
- Perform approximate spatial joins between two large datasets by indexing both on H3 and joining on cell identity.
- Generate buffered spatial indexes around geometries using k-ring operations for distance-based queries.
- Organize geospatial data into hierarchical hexagonal grids for efficient map visualization and aggregation.
- Implement distance joins by combining H3 indexing with secondary distance validation using a UDF.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides PySpark bindings for H3, enabling hexagonal geospatial indexing operations on distributed DataFrames—converting coordinates to H3 cells, indexing geometries, and performing spatial joins at scale.
Yes, if you are already using PySpark and need distributed H3 indexing—it has no runtime dependencies, low install friction, and a permissive license. However, be aware that the package is dormant; verify compatibility with your PySpark and H3 versions before committing to production. No known security vulnerabilities.
Install
h3-pyspark on PyPI
pip
pip install h3-pysparkuv
uv add h3-pysparkpoetry
poetry add h3-pysparkInstalling h3-pyspark
Before you install
Low friction installation as a pure-Python wheel. Maintenance is dormant—last release was 2022-03-10, with no updates since, though the repository remains active and unarchived. No runtime dependencies to manage.
License in practice
Licensed under MIT (permissive), allowing use in proprietary and open-source projects without significant restrictions.
Quickstart
pip install h3-pyspark
from pyspark.sql import SparkSession, functions as F
import h3_pyspark
spark = SparkSession.builder.getOrCreate()
df = spark.createDataFrame([{"lat": 37.769377, "lng": -122.388903, "resolution": 9}])
df = df.withColumn('h3_9', h3_pyspark.geo_to_h3('lat', 'lng', 'resolution'))
df.show()
Requires PySpark to be installed and a running Spark environment; requires Python >=3.6.
Verify before relying
- Whether the package works with recent PySpark versions (last release predates significant Spark API changes).
- Compatibility with modern H3 core library versions and whether h3-py dependency is pinned or flexible.
- Performance characteristics on large-scale distributed workloads compared to native Spark geospatial functions.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,618 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 225,618/month — #9,218 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: h3_pyspark-1.2.6-py3-none-any.whl
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
s2spheres2sphere provides Python bindings to work with…
permissive · top 15,000 on PyPI
pydeckPydeck provides Python bindings for deck.gl,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
dask-geopandasDask-GeoPandas parallelizes geospatial…
permissive · top 15,000 on PyPI
pyspark-extensionProvides Python bindings and utilities for…
permissive · top 15,000 on PyPI
pyspark-hnswProvides a PySpark-compatible implementation of…
unclear · top 15,000 on PyPI
pygeoifPyGeoIf provides lightweight, pure-Python…
copyleft · top 15,000 on PyPI
topojsontopojson encodes spatial data into TopoJSON…
permissive · top 15,000 on PyPI
cmeel-octomapProvides Python bindings to OctoMap, a 3D…
unclear · top 15,000 on PyPI