Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-port-ch-private-deployment-options.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
H3 Index
H3 is a geographical indexing system where the Earth’s surface is divided into a grid of even hexagonal cells. This system is hierarchical, i. e. each hexagon on the top level (“parent”) can be split into seven even but smaller ones (“children”), and so on. The level of the hierarchy is calledresolution and can receive a value from 0 till 15, where 0 is the base level with the largest and coarsest cells.
A latitude and longitude pair can be transformed to a 64-bit H3 index, identifying a grid cell.
The H3 index is used primarily for bucketing locations and other geospatial manipulations.
The full description of the H3 system is available at the Uber Engineering site.
h3IsValid
Verifies whether the number is a valid H3 index. Syntaxh3index— Hexagon index number. UInt64.
Query
Response
h3GetResolution
Defines the resolution of the given H3 index. Syntaxh3index— Hexagon index number. UInt64.
- Index resolution. Range:
[0, 15]. UInt8. - If the index is not valid, the function returns a random value. Use h3IsValid to verify the index. UInt8.
Query
Response
h3EdgeAngle
Calculates the average length of an H3 hexagon edge in grades. Syntaxresolution— Index resolution. UInt8. Range:[0, 15].
Query
Response
h3EdgeLengthM
Calculates the average length of an H3 hexagon edge in meters. Syntaxresolution— Index resolution. UInt8. Range:[0, 15].
Query
Response
h3EdgeLengthKm
Calculates the average length of an H3 hexagon edge in kilometers. Syntaxresolution— Index resolution. UInt8. Range:[0, 15].
Query
Response
geoToH3
Returns H3 point index(lat, lon) with specified resolution.
Syntax
lat— Latitude. Float64.lon— Longitude. Float64.resolution— Index resolution. Range:[0, 15]. UInt8.
geoToH3() takes values in order (lon, lat). As per ClickHouse v25.5, the input values are in order (lat, lon). The previous behaviour can be restored using setting geotoh3_argument_order = 'lon_lat'.
Example
Query
Response
h3ToGeo
Returns the centroid latitude and longitude corresponding to the provided H3 index. Syntaxh3Index— H3 Index. UInt64.
- A tuple consisting of two values:
tuple(lat,lon).lat— Latitude. Float64.lon— Longitude. Float64.
h3ToGeo() returns values in order (lon, lat). As per ClickHouse v25.1, the returned values are in order (lat, lon). The previous behaviour can be restored using setting h3togeo_lon_lat_result_order = true.
Example
Query
Response
h3ToGeoBoundary
Returns array of pairs(lat, lon), which corresponds to the boundary of the provided H3 index.
Syntax
h3Index— H3 Index. UInt64.
Query
Response
h3kRing
Lists all the H3 hexagons in the raduis ofk from the given hexagon in random order.
Syntax
Query
Response
h3PolygonToCells
Returns the hexagons (at specified resolution) contained by the provided geometry, either ring or (multi-)polygon. Syntaxgeometrycan be one of the following Geo Data Types or their underlying primitive types:resolution— Index resolution. Range:[0, 15]. UInt8.
Query
Response
h3GetBaseCell
Returns the base cell number of the H3 index. Syntaxindex— Hexagon index number. UInt64.
- Hexagon base cell number. UInt8.
Query
Response
h3HexAreaM2
Returns average hexagon area in square meters at the given resolution. Syntaxresolution— Index resolution. Range:[0, 15]. UInt8.
- Area in square meters. Float64.
Query
Response
h3HexAreaKm2
Returns average hexagon area in square kilometers at the given resolution. Syntaxresolution— Index resolution. Range:[0, 15]. UInt8.
- Area in square kilometers. Float64.
Query
Response
h3IndexesAreNeighbors
Returns whether or not the provided H3 indexes are neighbors. SyntaxQuery
Response
h3ToChildren
Returns an array of child indexes for the given H3 index. SyntaxQuery
Response
h3ToParent
Returns the parent (coarser) index containing the given H3 index. Syntax- Parent H3 index. UInt64.
Query
Response
h3ToString
Converts theH3Index representation of the index to the string representation.
index— Hexagon index number. UInt64.
- String representation of the H3 index. String.
Query
Response
stringToH3
Converts the string representation to theH3Index (UInt64) representation.
Syntax
index_str— String representation of the H3 index. String.
- Hexagon index number. Returns 0 on error. UInt64.
Query
Response
h3GetResolution
Returns the resolution of the H3 index. Syntaxindex— Hexagon index number. UInt64.
- Index resolution. Range:
[0, 15]. UInt8.
Query
Response
h3IsResClassIII
Returns whether H3 index has a resolution with Class III orientation. Syntaxindex— Hexagon index number. UInt64.
1— Index has a resolution with Class III orientation. UInt8.0— Index doesn’t have a resolution with Class III orientation. UInt8.
Query
Response
h3IsPentagon
Returns whether this H3 index represents a pentagonal cell. Syntaxindex— Hexagon index number. UInt64.
1— Index represents a pentagonal cell. UInt8.0— Index doesn’t represent a pentagonal cell. UInt8.
Query
Response
h3GetFaces
Returns icosahedron faces intersected by a given H3 index. Syntaxindex— Hexagon index number. UInt64.
Query
Response
h3CellAreaM2
Returns the exact area of a specific cell in square meters corresponding to the given input H3 index. Syntaxindex— Hexagon index number. UInt64.
- Cell area in square meters. Float64.
Query
Response
h3CellAreaRads2
Returns the exact area of a specific cell in square radians corresponding to the given input H3 index. Syntaxindex— Hexagon index number. UInt64.
- Cell area in square radians. Float64.
Query
Response
h3ToCenterChild
Returns the center child (finer) H3 index contained by given H3 at the given resolution. SyntaxQuery
Response
h3ExactEdgeLengthM
Returns the exact edge length of the unidirectional edge represented by the input h3 index in meters. Syntaxindex— Hexagon index number. UInt64.
- Exact edge length in meters. Float64.
Query
Response
h3ExactEdgeLengthKm
Returns the exact edge length of the unidirectional edge represented by the input h3 index in kilometers. Syntaxindex— Hexagon index number. UInt64.
- Exact edge length in kilometers. Float64.
Query
Response
h3ExactEdgeLengthRads
Returns the exact edge length of the unidirectional edge represented by the input h3 index in radians. Syntaxindex— Hexagon index number. UInt64.
- Exact edge length in radians. Float64.
Query
Response
h3NumHexagons
Returns the number of unique H3 indices at the given resolution. Syntaxresolution— Index resolution. Range:[0, 15]. UInt8.
- Number of H3 indices. Int64.
Query
Response
h3PointDistM
Returns the “great circle” or “haversine” distance between pairs of GeoCoord points (latitude/longitude) pairs in meters. Syntaxlat1,lon1— Latitude and Longitude of point1 in degrees. Float64.lat2,lon2— Latitude and Longitude of point2 in degrees. Float64.
- Haversine or great circle distance in meters.Float64.
Query
Response
h3PointDistKm
Returns the “great circle” or “haversine” distance between pairs of GeoCoord points (latitude/longitude) pairs in kilometers. Syntaxlat1,lon1— Latitude and Longitude of point1 in degrees. Float64.lat2,lon2— Latitude and Longitude of point2 in degrees. Float64.
- Haversine or great circle distance in kilometers. Float64.
Query
Response
h3PointDistRads
Returns the “great circle” or “haversine” distance between pairs of GeoCoord points (latitude/longitude) pairs in radians. Syntaxlat1,lon1— Latitude and Longitude of point1 in degrees. Float64.lat2,lon2— Latitude and Longitude of point2 in degrees. Float64.
- Haversine or great circle distance in radians. Float64.
Query
Response
h3GetRes0Indexes
Returns an array of all the resolution 0 H3 indexes. SyntaxQuery
Response
h3GetPentagonIndexes
Returns all the pentagon H3 indexes at the specified resolution. Syntaxresolution— Index resolution. Range:[0, 15]. UInt8.
Query
Response
h3Line
Returns the line of indices between the two indices that are provided. Syntaxstart— Hexagon index number that represents a starting point. UInt64.end— Hexagon index number that represents an ending point. UInt64.
Query
Response
h3Distance
Returns the distance in grid cells between the two indices that are provided. Syntaxstart— Hexagon index number that represents a starting point. UInt64.end— Hexagon index number that represents an ending point. UInt64.
- Number of grid cells. Int64.
Query
Response
h3HexRing
Returns the indexes of the hexagonal ring centered at the provided origin h3Index and length k. Returns 0 if no pentagonal distortion was encountered. SyntaxQuery
Response
h3GetUnidirectionalEdge
Returns a unidirectional edge H3 index based on the provided origin and destination and returns 0 on error. SyntaxoriginIndex— Origin Hexagon index number. UInt64.destinationIndex— Destination Hexagon index number. UInt64.
- Unidirectional Edge Hexagon Index number. UInt64.
Query
Response
h3UnidirectionalEdgeIsValid
Determines if the provided H3Index is a valid unidirectional edge index. Returns 1 if it’s a unidirectional edge and 0 otherwise. Syntaxindex— Hexagon index number. UInt64.
- 1 — The H3 index is a valid unidirectional edge. UInt8.
- 0 — The H3 index is not a valid unidirectional edge. UInt8.
Query
Response
h3GetOriginIndexFromUnidirectionalEdge
Returns the origin hexagon index from the unidirectional edge H3Index. Syntaxedge— Hexagon index number that represents a unidirectional edge. UInt64.
- Origin Hexagon Index number. UInt64.
Query
Response
h3GetDestinationIndexFromUnidirectionalEdge
Returns the destination hexagon index from the unidirectional edge H3Index. Syntaxedge— Hexagon index number that represents a unidirectional edge. UInt64.
- Destination Hexagon Index number. UInt64.
Query
Response
h3GetIndexesFromUnidirectionalEdge
Returns the origin and destination hexagon indexes from the given unidirectional edge H3Index. Syntaxedge— Hexagon index number that represents a unidirectional edge. UInt64.
tuple(origin,destination):
origin— Origin Hexagon index number. UInt64.destination— Destination Hexagon index number. UInt64.
(0,0) if the provided input is not valid.
Example
Query
Response
h3GetUnidirectionalEdgesFromHexagon
Provides all of the unidirectional edges from the provided H3Index. Syntaxindex— Hexagon index number that represents a unidirectional edge. UInt64.
Query
Response
h3GetUnidirectionalEdgeBoundary
Returns the coordinates defining the unidirectional edge. Syntaxindex— Hexagon index number that represents a unidirectional edge. UInt64.
Query
Response