skillfed

h3-pyspark

PySpark bindings for H3, a hierarchical hexagonal geospatial indexing system

h3-pyspark v1.2.6 225.6K downloads/30d#9,218 on PyPI33
Permissive license DORMANT released

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-pyspark

uv

uv add h3-pyspark

poetry

poetry add h3-pyspark

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

pyspark geospatial indexingh3 hexagonal grid sparkdistributed spatial joinsh3 cells pysparkgeospatial bucketing sparkcoordinate to h3 cellspatial index distributed
geospatialdistributed-computing

More Information Analysis packages