Last updated
Was this helpful?
Last updated
Was this helpful?
is Uber’s Hexagonal Hierarchical Spatial Index. Full documentation of the project can be found at . You can also learn more about H3 in the of this documentation.
Description
Returns a geography representing the H3 cell. It will return null
on error (invalid input).
index
: STRING
The H3 cell index as hexadecimal.
Return type
GEOGRAPHY
Example
Description
Returns the center of the H3 cell as a GEOGRAPHY point. It will return null
on error (invalid input).
index
: STRING
The H3 cell index.
Return type
GEOGRAPHY
Example
Description
Returns an array with the indexes of a set of hexagons across multiple resolutions that represent the same area as the input set of hexagons.
indexArray
: ARRAY
of H3 cell indices of the same resolution as hexadecimal.
Return type
ARRAY
Example
Description
Returns the grid distance between two hexagon indexes. This function may fail to find the distance between two indexes if they are very far apart or on opposite sides of a pentagon. Returns null
on failure or invalid input.
origin
: STRING
The H3 cell index as hexadecimal.
destination
: STRING
The H3 cell index as hexadecimal.
Return type
BIGINT
Example
tip
Description
Returns the H3 cell index that the point belongs to in the requested resolution
. It will return null
on error (invalid geography type or resolution out of bounds). This function is an alias for H3_FROMGEOPOINT
.
point
: GEOGRAPHY
point to get the H3 cell from.
Return type
STRING
Example
tip
Description
Returns the H3 cell index that the point belongs to in the required resolution
. It will return null
on error (resolution out of bounds).
longitude
: DOUBLE
horizontal coordinate of the map.
latitude
: DOUBLE
vertical coordinate of the map.
Return type
STRING
Example
Description
origin
: STRING
H3 cell index of the origin.
size
: INT
size of the ring (distance from the origin).
Return type
ARRAY
Example
Description
Converts the integer representation of the H3 index to the string representation.
index
: INT
The H3 cell index.
Return type
STRING
Example
Description
Returns true
if given H3 index is a pentagon. Returns false
otherwise, even on invalid input.
index
: STRING
The H3 cell index as hexadecimal.
Return type
BOOLEAN
Example
Description
Returns true
when the given index is valid, false
otherwise.
index
: STRING
The H3 cell index as hexadecimal.
Return type
BOOLEAN
Examples
Description
Returns all cell indexes in a filled hexagonal k-ring centered at the origin in no particular order.
origin
: STRING
H3 cell index of the origin.
size
: INT
size of the ring (distance from the origin).
Return type
ARRAY
Example
Description
Returns all cell indexes and their distances in a filled hexagonal k-ring centered at the origin in no particular order.
origin
: STRING
H3 cell index of the origin.
size
: INT
size of the ring (distance from the origin).
Return type
ARRAY
Example
Description
Returns an array with all H3 cell indexes contained in the given polygon. There are three modes which decide if a H3 cell is contained in the polygon:
geography
: GEOGRAPHY
polygon or multipolygon representing the shape to cover. GeometryCollections are also allowed but they should contain polygon or multipolygon geographies. Non-Polygon types will not raise an error but will be ignored instead.
mode
: STRING
<center|contains|intersects>
. Optional. Defaults to 'center' mode.
center
The center point of the H3 cell must be within the polygon
contains
The H3 cell must be fully contained within the polygon (least inclusive)
intersects
The H3 cell intersects in any way with the polygon (most inclusive)
Mode center
:
Mode intersects
:
Mode contains
:
Return type
ARRAY<STRING>
Examples
Description
Returns a table with the H3 cell indexes contained in the given polygon at a requested resolution. Containment is determined by the mode: center, intersects, contains. All the attributes except the polygon will be included in the output table, clustered by the h3 column.
input_query
: STRING
input data to polyfill. It must contain a column geom
with the shape to cover. Additionally, other columns can be included.
mode
: STRING
<center|contains|intersects>
. Optional. Defaults to 'center' mode.
center
The center point of the H3 cell must be within the polygon
contains
The H3 cell must be fully contained within the polygon (least inclusive)
intersects
The H3 cell intersects in any way with the polygon (most inclusive)
Mode center
:
Mode intersects
:
Mode contains
:
Output
The results are stored in the table named <output_table>
, which contains the following columns:
h3
: STRING
the geometry of the considered point.
The rest of columns included in input_query
except geom
.
Examples
Description
Returns the H3 cell resolution as an integer. It will return null
on error (invalid input).
index
: STRING
The H3 cell index.
Return type
INT
Example
Description
Converts the string representation of the H3 index to the integer representation.
index
: STRING
The H3 cell index.
Return type
INT
Example
Description
Returns an array with the indexes of the children/descendents of the given hexagon at the given resolution.
index
: STRING
The H3 cell index as hexadecimal.
Return type
ARRAY
Example
Description
Returns the H3 cell index of the parent of the given hexagon at the given resolution.
index
: STRING
The H3 cell index as hexadecimal.
Return type
STRING
Example
Description
indexArray
: ARRAY
of H3 cell indices as hexadecimal.
Return type
ARRAY
Example
If you want the distance in meters use between the cells () or their centroid.
resolution
: INT
number between 0 and 15 with the .
If you want the cells covered by a POLYGON see .
resolution
: INT
number between 0 and 15 with the .
Returns all cell indexes in a hollow hexagonal ring centered at the origin in no particular order. Unlike , this function will throw an exception if there is a pentagon anywhere in the ring.
resolution
: INT
number between 0 and 15 with the .
resolution
: INT
number between 0 and 15 with the .
resolution
: INT
number between 0 and 15 with the .
resolution
: INT
number between 0 and 15 with the .
Returns an array with the indexes of a set of hexagons of the same resolution
that represent the same area as the input hexagons.
resolution
: INT
number between 0 and 15 with the .