Skip to content

H3 hexagonal indexing in SQL

Convert coordinates to H3 cells, traverse the hexagonal grid, and run spatial aggregations directly in SQL. H3 min/max statistics let the query planner skip irrelevant Parquet files on large tables.

H3 indexing at 16 resolution levels (continent to sub-meter)
H3-aware file pruning for spatial queries on Delta tables
PostGIS-compatible st_* spatial functions
Resolution Res 0 1,107 km Res 7 1.2 km Res 9 174 m Res 15 0.5 m SELECT h3_latlng_to_cell (lat, lng, 9 ) AS cell, COUNT(*) FROM locations GROUP BY cell ORDER BY 2 DESC

What you can do in SQL, without Databricks

Indexing, traversal, and spatial predicates without leaving the query

Index and aggregate

Convert coordinates into H3 cells, then group, count, and run H3 spatial joins on Delta tables by matching datasets on a shared cell. Sixteen resolutions span continent-scale buckets down to sub-meter precision.

Traverse the grid

Find neighbors, draw rings and disks, walk paths between cells, and move up or down the resolution hierarchy. Hex topology is built in, not bolted on.

Spatial predicates

PostGIS-style functions for distance, containment, area, centroid, and buffer. Existing spatial SQL ports across with minimal change.

The planner uses H3 to skip files

Spatial queries on large tables only read the files that matter

How pruning works

Each Parquet file records the H3 cell range of its rows. Spatial predicates let the planner drop any file whose range does not intersect the query region.

What it covers

Cell equality, parent and child containment, and distance filters. Composes with Delta partitioning and Z-ordering on the same table.

What this is for, and what it is not

H3 cell analytics over point data, stated plainly

Built for point aggregation

The sweet spot is point-heavy workloads: bucket events into cells, join datasets on a shared H3 cell, and roll results up or down the resolution hierarchy on Delta tables.

Not a full GIS

DeltaForge does not implement geometry column types or GeoParquet. If your workload centers on polygon editing or topology operations, a dedicated GIS such as PostGIS remains the right tool.

Further reading

Hands-on guides for the Delta tables your H3 queries run on

OPTIMIZE, VACUUM and Z-ORDER Without Spark: The Delta Maintenance Runbook

Keep the tables behind your spatial queries compact and well clustered, including the Z-ordering that H3 pruning composes with.

CSV to Delta Lake Without Spark: Two SQL Statements

Load raw point data from CSV into a Delta table you can index with H3, using nothing but SQL.

Run spatial queries where the data lives

H3 indexing and spatial functions built into the SQL engine.