Applies to: Databricks SQL Databricks Runtime
H3 is a global grid indexing system. Grid systems use a shape, like rectangles or triangles, to tessellate a surface, which in this case is the Earth's surface. The H3 system was designed to use hexagons (and a few pentagons), and offers 16 levels of resolutions within its hierarchy. At higher resolutions, the tesselated shapes are smaller.
H3 expressions are only supported in Photon-enabled clusters and Databricks SQL warehouses at the Databricks SQL pro and serverless tiers.
Read more about H3 resolutions, and about the origins of H3.
See also:
H3 supports a common pattern for processing and analyzing spatial data. Start by indexing geospatial data from standard formats (latitude and longitude, Well-known text (WKT), Well-known binary (WKB), or GeoJSON to H3 cell IDs. With a single dataset, you can aggregate by cell ID to answer location-driven questions. With multiple indexed datasets, you can combine them using the cell IDs, revealing how disparate datasets relate to one another. This joining of datasets is semantically a spatial join, but without the need for a spatial predicate.
What are the benefits of using H3 within Databricks?âLeverage Delta Lake features for efficient storage and layout of your H3 indexed data. Delta Lake's OPTIMIZE operation with Z-ordering (on H3 cell IDs) allows you to spatially co-locate data. Further, Delta Lake's data skipping algorithms use co-locality to intelligently reduce the volume of data that needs to be read.
You have flexibility in how you work with the data. You can choose to work with H3 cell IDs stored as big integers or strings. For the best performance using H3 cell IDs, use the big integer representation. For detailed use of H3 expressions refer to the SQL reference guide.
note
You do not need to install the H3 library. It is included as a visible dependency in Databricks Runtime, starting with Databricks Runtime 11.2, using version 3.7.0 of the H3 Java library.
Import Databricks functions to get H3 (Databricks Runtime)âNo import needed for Databricks SQL and Spark SQL.
To import H3 functions for Python or Scala in notebooks, use the following commands:
Python
from pyspark.databricks.sql import functions as dbf
Scala
import com.databricks.sql.functions._
List of H3 geospatial functions (Databricks SQL)â Importâ Exportâ Conversionsâ Predicatesâ Validityâ Traversalâ Compactionâ
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4