This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Geography Functions

1 - GEO_TO_H3

Returns the H3 index of the hexagon cell where the given location resides. Returning 0 means an error occurred.

Analyze Syntax

func.geo_to_h3(lon, lat, res)

Analyze Examples

func.geo_to_h3(37.79506683, 55.71290588, 15)

┌──────────────────────────────────────────────┐
 func.geo_to_h3(37.79506683, 55.71290588, 15) 
├──────────────────────────────────────────────┤
                           644325524701193974 
└──────────────────────────────────────────────┘

SQL Syntax

GEO_TO_H3(lon, lat, res)

SQL Examples

SELECT GEO_TO_H3(37.79506683, 55.71290588, 15);

┌─────────────────────────────────────────┐
 geo_to_h3(37.79506683, 55.71290588, 15) 
├─────────────────────────────────────────┤
                      644325524701193974 
└─────────────────────────────────────────┘

2 - GEOHASH_DECODE

Converts a Geohash-encoded string into latitude/longitude coordinates.

Analyze Syntax

func.geohash_decode('<geohashed-string\>')

Analyze Examples

func.geohash_decode('ezs42')

┌─────────────────────────────────┐
  func.geohash_decode('ezs42')   
├─────────────────────────────────┤
 (-5.60302734375,42.60498046875) 
└─────────────────────────────────┘

SQL Syntax

GEOHASH_DECODE('<geohashed-string\>')

SQL Examples

SELECT GEOHASH_DECODE('ezs42');

┌─────────────────────────────────┐
     geohash_decode('ezs42')     
├─────────────────────────────────┤
 (-5.60302734375,42.60498046875) 
└─────────────────────────────────┘

3 - GEOHASH_ENCODE

Converts a pair of latitude and longitude coordinates into a Geohash-encoded string.

Analyze Syntax

func.geohash_encode(lon, lat)

Analyze Examples

func.geohash_encode(-5.60302734375, 42.593994140625)

┌─────────────────────────────────────────────────────────┐
 func.geohash_encode((- 5.60302734375), 42.593994140625) 
├─────────────────────────────────────────────────────────┤
 ezs42d000000                                            
└─────────────────────────────────────────────────────────┘

SQL Syntax

GEOHASH_ENCODE(lon, lat)

SQL Examples

SELECT GEOHASH_ENCODE(-5.60302734375, 42.593994140625);

┌────────────────────────────────────────────────────┐
 geohash_encode((- 5.60302734375), 42.593994140625) 
├────────────────────────────────────────────────────┤
 ezs42d000000                                       
└────────────────────────────────────────────────────┘

4 - H3_CELL_AREA_M2

Returns the exact area of specific cell in square meters.

Analyze Syntax

func.h3_cell_area_m2(h3)

Analyze Examples

func.h3_cell_area_m2(599119489002373119)

┌──────────────────────────────────────────┐
 func.h3_cell_area_m2(599119489002373119) 
├──────────────────────────────────────────┤
                       127785582.60809991 
└──────────────────────────────────────────┘

SQL Syntax

H3_CELL_AREA_M2(h3)

SQL Examples

SELECT H3_CELL_AREA_M2(599119489002373119);

┌─────────────────────────────────────┐
 h3_cell_area_m2(599119489002373119) 
├─────────────────────────────────────┤
                  127785582.60809991 
└─────────────────────────────────────┘

5 - H3_CELL_AREA_RADS2

Returns the exact area of specific cell in square radians.

Analyze Syntax

func.h3_cell_area_rads2(h3)

Analyze Examples

func.h3_cell_area_rads2(599119489002373119)

┌─────────────────────────────────────────────┐
 func.h3_cell_area_rads2(599119489002373119) 
├─────────────────────────────────────────────┤
                     0.000003148224310427697 
└─────────────────────────────────────────────┘

SQL Syntax

H3_CELL_AREA_RADS2(h3)

SQL Examples

SELECT H3_CELL_AREA_RADS2(599119489002373119);

┌────────────────────────────────────────┐
 h3_cell_area_rads2(599119489002373119) 
├────────────────────────────────────────┤
                0.000003148224310427697 
└────────────────────────────────────────┘

6 - H3_DISTANCE

Returns the grid distance between the the given two H3 indexes.

Analyze Syntax

func.h3_distance(h3, a_h3)

Analyze Examples

func.h3_distance(599119489002373119, 599119491149856767)

┌──────────────────────────────────────────────────────────┐
 func.h3_distance(599119489002373119, 599119491149856767) 
├──────────────────────────────────────────────────────────┤
                                                        1 
└──────────────────────────────────────────────────────────┘

SQL Syntax

H3_DISTANCE(h3, a_h3)

SQL Examples

SELECT H3_DISTANCE(599119489002373119, 599119491149856767);

┌─────────────────────────────────────────────────────┐
 h3_distance(599119489002373119, 599119491149856767) 
├─────────────────────────────────────────────────────┤
                                                   1 
└─────────────────────────────────────────────────────┘

7 - H3_EDGE_ANGLE

Returns the average length of the H3 hexagon edge in grades.

Analyze Syntax

func.h3_edge_angle(res)

Analyze Examples

func.h3_edge_angle(10)

┌────────────────────────────┐
   func.h3_edge_angle(10)   
├────────────────────────────┤
      0.0006822586214153981 
└────────────────────────────┘

SQL Syntax

H3_EDGE_ANGLE(res)

SQL Examples

SELECT H3_EDGE_ANGLE(10);

┌───────────────────────┐
   h3_edge_angle(10)   
├───────────────────────┤
 0.0006822586214153981 
└───────────────────────┘

8 - H3_EDGE_LENGTH_KM

Returns the average hexagon edge length in kilometers at the given resolution. Excludes pentagons.

Analyze Syntax

func.h3_edge_length_km(res)

Analyze Examples

func.h3_edge_length_km(1)

┌───────────────────────────┐
 func.h3_edge_length_km(1) 
├───────────────────────────┤
         483.0568390711111 
└───────────────────────────┘

SQL Syntax

H3_EDGE_LENGTH_KM(res)

SQL Examples

SELECT H3_EDGE_LENGTH_KM(1);

┌──────────────────────┐
 h3_edge_length_km(1) 
├──────────────────────┤
    483.0568390711111 
└──────────────────────┘

9 - H3_EDGE_LENGTH_M

Returns the average hexagon edge length in meters at the given resolution. Excludes pentagons.

Analyze Syntax

func.h3_edge_length(1)

Analyze Examples

func.h3_edge_length(1)

┌──────────────────────────┐
 func.h3_edge_length_m(1) 
├──────────────────────────┤
        483056.8390711111 
└──────────────────────────┘

SQL Syntax

H3_EDGE_LENGTH_M(1)

SQL Examples

┌─────────────────────┐
 h3_edge_length_m(1) 
├─────────────────────┤
   483056.8390711111 
└─────────────────────┘

10 - H3_EXACT_EDGE_LENGTH_KM

Computes the length of this directed edge, in kilometers.

Analyze Syntax

func.h3_exact_edge_length_km(h3)

Analyze Examples

func.h3_exact_edge_length_km(1319695429381652479)

┌───────────────────────────────────────────────────┐
 func.h3_exact_edge_length_km(1319695429381652479) 
├───────────────────────────────────────────────────┤
                                 8.267326832647143 
└───────────────────────────────────────────────────┘

SQL Syntax

H3_EXACT_EDGE_LENGTH_KM(h3)

SQL Examples

SELECT H3_EXACT_EDGE_LENGTH_KM(1319695429381652479);

┌──────────────────────────────────────────────┐
 h3_exact_edge_length_km(1319695429381652479) 
├──────────────────────────────────────────────┤
                            8.267326832647143 
└──────────────────────────────────────────────┘

11 - H3_EXACT_EDGE_LENGTH_M

Computes the length of this directed edge, in meters.

Analyze Syntax

func.h3_exact_edge_length_m(h3)

Analyze Examples

func.h3_exact_edge_length_m(1319695429381652479)

┌──────────────────────────────────────────────────┐
 func.h3_exact_edge_length_m(1319695429381652479) 
├──────────────────────────────────────────────────┤
                                8267.326832647143 
└──────────────────────────────────────────────────┘

SQL Syntax

H3_EXACT_EDGE_LENGTH_M(h3)

SQL Examples

SELECT H3_EXACT_EDGE_LENGTH_M(1319695429381652479);

┌─────────────────────────────────────────────┐
 h3_exact_edge_length_m(1319695429381652479) 
├─────────────────────────────────────────────┤
                           8267.326832647143 
└─────────────────────────────────────────────┘

12 - H3_EXACT_EDGE_LENGTH_RADS

Computes the length of this directed edge, in radians.

Analyze Syntax

func.h3_exact_edge_length_km(h3)

Analyze Examples

func.h3_exact_edge_length_km(1319695429381652479)

┌───────────────────────────────────────────────────┐
 func.h3_exact_edge_length_km(1319695429381652479) 
├───────────────────────────────────────────────────┤
                                 8.267326832647143 
└───────────────────────────────────────────────────┘

SQL Syntax

H3_EXACT_EDGE_LENGTH_RADS(h3)

SQL Examples

SELECT H3_EXACT_EDGE_LENGTH_KM(1319695429381652479);

┌──────────────────────────────────────────────┐
 h3_exact_edge_length_km(1319695429381652479) 
├──────────────────────────────────────────────┤
                            8.267326832647143 
└──────────────────────────────────────────────┘

13 - H3_GET_BASE_CELL

Returns the base cell number of the given H3 index.

Analyze Syntax

func.h3_get_base_cell(h3)

Analyze Examples

func.h3_get_base_cell(644325524701193974)

┌───────────────────────────────────────────┐
 func.h3_get_base_cell(644325524701193974) 
├───────────────────────────────────────────┤
                                         8 
└───────────────────────────────────────────┘

SQL Syntax

H3_GET_BASE_CELL(h3)

SQL Examples

SELECT H3_GET_BASE_CELL(644325524701193974);

┌──────────────────────────────────────┐
 h3_get_base_cell(644325524701193974) 
├──────────────────────────────────────┤
                                    8 
└──────────────────────────────────────┘

14 - H3_GET_DESTINATION_INDEX_FROM_UNIDIRECTIONAL_EDGE

Returns the destination hexagon index from the unidirectional edge H3Index.

Analyze Syntax

func.h3_get_destination_index_from_unidirectional_edge(h3)

Analyze Examples

func.h3_get_destination_index_from_unidirectional_edge(1248204388774707199)

┌─────────────────────────────────────────────────────────────────────────────┐
 func.h3_get_destination_index_from_unidirectional_edge(1248204388774707199) 
├─────────────────────────────────────────────────────────────────────────────┤
                                                          599686043507097599 
└─────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_GET_DESTINATION_INDEX_FROM_UNIDIRECTIONAL_EDGE(h3)

SQL Examples

SELECT H3_GET_DESTINATION_INDEX_FROM_UNIDIRECTIONAL_EDGE(1248204388774707199);

┌────────────────────────────────────────────────────────────────────────┐
 h3_get_destination_index_from_unidirectional_edge(1248204388774707199) 
├────────────────────────────────────────────────────────────────────────┤
                                                     599686043507097599 
└────────────────────────────────────────────────────────────────────────┘

15 - H3_GET_FACES

Finds all icosahedron faces intersected by the given H3 index. Faces are represented as integers from 0-19.

Analyze Syntax

func.h3_get_faces(h3)

Analyze Examples

func.h3_get_faces(599119489002373119)

┌───────────────────────────────────────┐
 func.h3_get_faces(599119489002373119) 
├───────────────────────────────────────┤
 [0,1,2,3,4]                           
└───────────────────────────────────────┘

SQL Syntax

H3_GET_FACES(h3)

SQL Examples

SELECT H3_GET_FACES(599119489002373119);

┌──────────────────────────────────┐
 h3_get_faces(599119489002373119) 
├──────────────────────────────────┤
 [0,1,2,3,4]                      
└──────────────────────────────────┘

16 - H3_GET_INDEXES_FROM_UNIDIRECTIONAL_EDGE

Returns the origin and destination hexagon indexes from the given unidirectional edge H3Index.

Analyze Syntax

func.h3_get_indexes_from_unidirectional_edge(h3)

Analyze Examples

func.h3_get_indexes_from_unidirectional_edge(1248204388774707199)

┌────────────────────────────────────────────────────────────────────┐
 func.h3_get_indexes_from_unidirectional_edge(1248204388774707199)  
├────────────────────────────────────────────────────────────────────┤
 (599686042433355775,599686043507097599)                            
└────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_GET_INDEXES_FROM_UNIDIRECTIONAL_EDGE(h3)

SQL Examples

SELECT H3_GET_INDEXES_FROM_UNIDIRECTIONAL_EDGE(1248204388774707199);

┌──────────────────────────────────────────────────────────────┐
 h3_get_indexes_from_unidirectional_edge(1248204388774707199) 
├──────────────────────────────────────────────────────────────┤
 (599686042433355775,599686043507097599)                      
└──────────────────────────────────────────────────────────────┘

17 - H3_GET_ORIGIN_INDEX_FROM_UNIDIRECTIONAL_EDGE

Returns the origin hexagon index from the unidirectional edge H3Index.

Analyze Syntax

func.h3_get_origin_index_from_unidirectional_edge(h3)

Analyze Examples

func.h3_get_origin_index_from_unidirectional_edge(1248204388774707199)

┌────────────────────────────────────────────────────────────────────────┐
 func.h3_get_origin_index_from_unidirectional_edge(1248204388774707199) 
├────────────────────────────────────────────────────────────────────────┤
                                                     599686042433355775 
└────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_GET_ORIGIN_INDEX_FROM_UNIDIRECTIONAL_EDGE(h3)

SQL Examples

SELECT H3_GET_ORIGIN_INDEX_FROM_UNIDIRECTIONAL_EDGE(1248204388774707199);

┌───────────────────────────────────────────────────────────────────┐
 h3_get_origin_index_from_unidirectional_edge(1248204388774707199) 
├───────────────────────────────────────────────────────────────────┤
                                                599686042433355775 
└───────────────────────────────────────────────────────────────────┘

18 - H3_GET_RESOLUTION

Returns the resolution of the given H3 index.

Analyze Syntax

func.h3_get_resolution(h3)

Analyze Examples

func.h3_get_resolution(644325524701193974)

┌────────────────────────────────────────────┐
 func.h3_get_resolution(644325524701193974) 
├────────────────────────────────────────────┤
                                         15 
└────────────────────────────────────────────┘

SQL Syntax

H3_GET_RESOLUTION(h3)

SQL Examples

SELECT H3_GET_RESOLUTION(644325524701193974);

┌───────────────────────────────────────┐
 h3_get_resolution(644325524701193974) 
├───────────────────────────────────────┤
                                    15 
└───────────────────────────────────────┘

19 - H3_GET_UNIDIRECTIONAL_EDGE

Returns the edge between the given two H3 indexes.

Analyze Syntax

func.h3_get_unidirectional_edge(h3, a_h3)

Analyze Examples

func.h3_get_unidirectional_edge(644325524701193897, 644325524701193754)

┌─────────────────────────────────────────────────────────────────────────┐
 func.h3_get_unidirectional_edge(644325524701193897, 644325524701193754) 
├─────────────────────────────────────────────────────────────────────────┤
                                                     1581074247194257065 
└─────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_GET_UNIDIRECTIONAL_EDGE(h3, a_h3)

SQL Examples

SELECT H3_GET_UNIDIRECTIONAL_EDGE(644325524701193897, 644325524701193754);

┌────────────────────────────────────────────────────────────────────┐
 h3_get_unidirectional_edge(644325524701193897, 644325524701193754) 
├────────────────────────────────────────────────────────────────────┤
                                                1581074247194257065 
└────────────────────────────────────────────────────────────────────┘

20 - H3_GET_UNIDIRECTIONAL_EDGE_BOUNDARY

Returns the coordinates defining the unidirectional edge.

Analyze Syntax

func.h3_get_unidirectional_edge_boundary(h3)

Analyze Examples

func.h3_get_unidirectional_edge_boundary(1248204388774707199)

┌─────────────────────────────────────────────────────────────────────────────────┐
           func.h3_get_unidirectional_edge_boundary(1248204388774707199)         
├─────────────────────────────────────────────────────────────────────────────────┤
 [(37.42012867767778,-122.03773496427027),(37.33755608435298,-122.090428929044)] 
└─────────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_GET_UNIDIRECTIONAL_EDGE_BOUNDARY(h3)

SQL Examples

SELECT H3_GET_UNIDIRECTIONAL_EDGE_BOUNDARY(1248204388774707199);

┌─────────────────────────────────────────────────────────────────────────────────┐
             h3_get_unidirectional_edge_boundary(1248204388774707199)            
├─────────────────────────────────────────────────────────────────────────────────┤
 [(37.42012867767778,-122.03773496427027),(37.33755608435298,-122.090428929044)] 
└─────────────────────────────────────────────────────────────────────────────────┘

21 - H3_GET_UNIDIRECTIONAL_EDGES_FROM_HEXAGON

Returns all of the unidirectional edges from the provided H3Index.

Analyze Syntax

func.h3_get_unidirectional_edges_from_hexagon(h3)

Analyze Examples

func.h3_get_unidirectional_edges_from_hexagon(644325524701193754)

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                              func.h3_get_unidirectional_edges_from_hexagon(644325524701193754)                            
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [1292843871042545178,1364901465080473114,1436959059118401050,1509016653156328986,1581074247194256922,1653131841232184858] 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_GET_UNIDIRECTIONAL_EDGES_FROM_HEXAGON(h3)

SQL Examples

SELECT H3_GET_UNIDIRECTIONAL_EDGES_FROM_HEXAGON(644325524701193754);

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                h3_get_unidirectional_edges_from_hexagon(644325524701193754)                               
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [1292843871042545178,1364901465080473114,1436959059118401050,1509016653156328986,1581074247194256922,1653131841232184858] 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

22 - H3_HEX_AREA_KM2

Returns the average hexagon area in square kilometers at the given resolution. Excludes pentagons.

Analyze Syntax

func.h3_area_km2(res)

Analyze Examples

func.h3_area_km2(1)

┌─────────────────────────┐
 func.h3_hex_area_km2(1) 
├─────────────────────────┤
       609788.4417941332 
└─────────────────────────┘

SQL Syntax

H3_HEX_AREA_KM2(res)

SQL Examples

SELECT H3_HEX_AREA_KM2(1);

┌────────────────────┐
 h3_hex_area_km2(1) 
├────────────────────┤
  609788.4417941332 
└────────────────────┘

23 - H3_HEX_AREA_M2

Returns the average hexagon area in square meters at the given resolution. Excludes pentagons.

Analyze Syntax

func.h3_hex_area_m2(res)

Analyze Examples

func.h3_hex_area_m2(1)

┌────────────────────────┐
 func.h3_hex_area_m2(1) 
├────────────────────────┤
      609788441794.1339 
└────────────────────────┘

SQL Syntax

H3_HEX_AREA_M2(res)

SQL Examples

SELECT H3_HEX_AREA_M2(1);

┌───────────────────┐
 h3_hex_area_m2(1) 
├───────────────────┤
 609788441794.1339 
└───────────────────┘

24 - H3_HEX_RING

Returns the "hollow" ring of hexagons at exactly grid distance k from the given H3 index.

Analyze Syntax

func.h3_hex_ring(h3, k)

Analyze Examples

func.h3_hex_ring(599686042433355775, 2)

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                                                                 func.h3_hex_ring(599686042433355775, 2)                                                                                               
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [599686018811035647,599686034917163007,599686029548453887,599686032769679359,599686198125920255,599686040285872127,599686041359613951,599686039212130303,599686023106002943,599686027400970239,599686013442326527,599686012368584703] 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_HEX_RING(h3, k)

SQL Examples

SELECT H3_HEX_RING(599686042433355775, 2);

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                                                                   h3_hex_ring(599686042433355775, 2)                                                                                                  
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [599686018811035647,599686034917163007,599686029548453887,599686032769679359,599686198125920255,599686040285872127,599686041359613951,599686039212130303,599686023106002943,599686027400970239,599686013442326527,599686012368584703] 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

25 - H3_INDEXES_ARE_NEIGHBORS

Returns whether or not the provided H3 indexes are neighbors.

Analyze Syntax

func.h3_indexes_are_neighbors(h3, a_h3)

Analyze Examples

func.h3_indexes_are_neighbors(644325524701193974, 644325524701193897)

┌───────────────────────────────────────────────────────────────────────┐
 func.h3_indexes_are_neighbors(644325524701193974, 644325524701193897) 
├───────────────────────────────────────────────────────────────────────┤
 true                                                                  
└───────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_INDEXES_ARE_NEIGHBORS(h3, a_h3)

SQL Examples

SELECT H3_INDEXES_ARE_NEIGHBORS(644325524701193974, 644325524701193897);

┌──────────────────────────────────────────────────────────────────┐
 h3_indexes_are_neighbors(644325524701193974, 644325524701193897) 
├──────────────────────────────────────────────────────────────────┤
 true                                                             
└──────────────────────────────────────────────────────────────────┘

26 - H3_IS_PENTAGON

Checks if the given H3 index represents a pentagonal cell.

Analyze Syntax

func.h3_is_pentagon(h3)

Analyze Examples

func.h3_is_pentagon(599119489002373119)

┌─────────────────────────────────────────┐
 func.h3_is_pentagon(599119489002373119) 
├─────────────────────────────────────────┤
 true                                    
└─────────────────────────────────────────┘

SQL Syntax

H3_IS_PENTAGON(h3)

SQL Examples

SELECT H3_IS_PENTAGON(599119489002373119);

┌────────────────────────────────────┐
 h3_is_pentagon(599119489002373119) 
├────────────────────────────────────┤
 true                               
└────────────────────────────────────┘

27 - H3_IS_RES_CLASS_III

Checks if the given H3 index has a resolution with Class III orientation.

Analyze Syntax

func.h3_is_res_class_iii(h3)

Analyze Examples

func.h3_is_res_class_iii(635318325446452991)

┌──────────────────────────────────────────────┐
 func.h3_is_res_class_iii(635318325446452991) 
├──────────────────────────────────────────────┤
 true                                         
└──────────────────────────────────────────────┘

SQL Syntax

H3_IS_RES_CLASS_III(h3)

SQL Examples

SELECT H3_IS_RES_CLASS_III(635318325446452991);

┌─────────────────────────────────────────┐
 h3_is_res_class_iii(635318325446452991) 
├─────────────────────────────────────────┤
 true                                    
└─────────────────────────────────────────┘

28 - H3_IS_VALID

Checks if the given H3 index is valid.

Analyze Syntax

func.h3_is_valid(h3)

Analyze Examples

func.h3_is_valid(644325524701193974)

┌──────────────────────────────────────┐
 func.h3_is_valid(644325524701193974) 
├──────────────────────────────────────┤
 true                                 
└──────────────────────────────────────┘

SQL Syntax

H3_IS_VALID(h3)

SQL Examples

SELECT H3_IS_VALID(644325524701193974);

┌─────────────────────────────────┐
 h3_is_valid(644325524701193974) 
├─────────────────────────────────┤
 true                            
└─────────────────────────────────┘

29 - H3_K_RING

Returns an array containing the H3 indexes of the k-ring hexagons surrounding the input H3 index. Each element in this array is an H3 index.

Analyze Syntax

func.h3_k_ring(h3, k)

Analyze Examples

func.h3_k_ring(644325524701193974, 1)

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                  func.h3_k_ring(644325524701193974, 1)                                                 
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [644325524701193974,644325524701193899,644325524701193869,644325524701193970,644325524701193968,644325524701193972,644325524701193897] 
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_K_RING(h3, k)

SQL Examples

SELECT H3_K_RING(644325524701193974, 1);

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                    h3_k_ring(644325524701193974, 1)                                                    
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [644325524701193974,644325524701193899,644325524701193869,644325524701193970,644325524701193968,644325524701193972,644325524701193897] 
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

30 - H3_LINE

Returns the line of indexes between the given two H3 indexes.

Analyze Syntax

func.h3_line(h3, a_h3)

Analyze Examples

func.h3_line(599119489002373119, 599119491149856767)

┌──────────────────────────────────────────────────────┐
 func.h3_line(599119489002373119, 599119491149856767) 
├──────────────────────────────────────────────────────┤
 [599119489002373119,599119491149856767]              
└──────────────────────────────────────────────────────┘

SQL Syntax

H3_LINE(h3, a_h3)

SQL Examples

SELECT H3_LINE(599119489002373119, 599119491149856767);

┌─────────────────────────────────────────────────┐
 h3_line(599119489002373119, 599119491149856767) 
├─────────────────────────────────────────────────┤
 [599119489002373119,599119491149856767]         
└─────────────────────────────────────────────────┘

31 - H3_NUM_HEXAGONS

Returns the number of unique H3 indexes at the given resolution.

Analyze Syntax

func.h3_num_hexagons(res)

Analyze Examples

func.h3_num_hexagons(10)

┌──────────────────────────┐
 func.h3_num_hexagons(10) 
├──────────────────────────┤
              33897029882 
└──────────────────────────┘

SQL Syntax

H3_NUM_HEXAGONS(res)

SQL Examples

SELECT H3_NUM_HEXAGONS(10);

┌─────────────────────┐
 h3_num_hexagons(10) 
├─────────────────────┤
         33897029882 
└─────────────────────┘

32 - H3_TO_CENTER_CHILD

Returns the center child index at the specified resolution.

Analyze Syntax

func.h3_to_center_child(h3, res)

Analyze Examples

func.h3_to_center_child(599119489002373119, 15)

┌─────────────────────────────────────────────────┐
 func.h3_to_center_child(599119489002373119, 15) 
├─────────────────────────────────────────────────┤
                              644155484202336256 
└─────────────────────────────────────────────────┘

SQL Syntax

H3_TO_CENTER_CHILD(h3, res)

SQL Examples

SELECT H3_TO_CENTER_CHILD(599119489002373119, 15);

┌────────────────────────────────────────────┐
 h3_to_center_child(599119489002373119, 15) 
├────────────────────────────────────────────┤
                         644155484202336256 
└────────────────────────────────────────────┘

33 - H3_TO_CHILDREN

Returns the indexes contained by h3 at resolution child_res.

Analyze Syntax

func.h3_to_children(h3, child_res)

Analyze Examples

func.h3_to_children(635318325446452991, 14)

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                               func.h3_to_children(635318325446452991, 14)                                              
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [639821925073823431,639821925073823439,639821925073823447,639821925073823455,639821925073823463,639821925073823471,639821925073823479] 
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_TO_CHILDREN(h3, child_res)

SQL Examples

SELECT H3_TO_CHILDREN(635318325446452991, 14);

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                 h3_to_children(635318325446452991, 14)                                                 
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [639821925073823431,639821925073823439,639821925073823447,639821925073823455,639821925073823463,639821925073823471,639821925073823479] 
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

34 - H3_TO_GEO

Returns the longitude and latitude corresponding to the given H3 index.

Analyze Syntax

func.h3_to_geo(h3)

Analyze Examples

func.h3_to_geo(644325524701193974)

┌────────────────────────────────────────┐
   func.h3_to_geo(644325524701193974)   
├────────────────────────────────────────┤
 (37.79506616830255,55.712902431456676) 
└────────────────────────────────────────┘

SQL Syntax

H3_TO_GEO(h3)

SQL Examples

SELECT H3_TO_GEO(644325524701193974);

┌────────────────────────────────────────┐
      h3_to_geo(644325524701193974)     
├────────────────────────────────────────┤
 (37.79506616830255,55.712902431456676) 
└────────────────────────────────────────┘

35 - H3_TO_GEO_BOUNDARY

Returns an array containing the longitude and latitude coordinates of the vertices of the hexagon corresponding to the H3 index.

Analyze Syntax

func.h3_to_geo_boundary(h3)

Analyze Examples

func.h3_to_geo_boundary(644325524701193974)

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                                                                 func.h3_to_geo_boundary(644325524701193974)                                                                                               
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [(37.79505811173477,55.712900225355526),(37.79506506997187,55.71289713485417),(37.795073126539855,55.71289934095484),(37.795074224871684,55.71290463755745),(37.79506726663349,55.71290772805916),(37.79505921006456,55.712905521957914)] 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

H3_TO_GEO_BOUNDARY(h3)

SQL Examples

SELECT H3_TO_GEO_BOUNDARY(644325524701193974);

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                                                                   h3_to_geo_boundary(644325524701193974)                                                                                                  
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 [(37.79505811173477,55.712900225355526),(37.79506506997187,55.71289713485417),(37.795073126539855,55.71289934095484),(37.795074224871684,55.71290463755745),(37.79506726663349,55.71290772805916),(37.79505921006456,55.712905521957914)] 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

36 - H3_TO_PARENT

Returns the parent index containing the h3 at resolution parent_res. Returning 0 means an error occurred.

Analyze Syntax

func.h3_to_parent(h3, parent_res)

Analyze Examples

func.h3_to_parent(635318325446452991, 12)

┌───────────────────────────────────────────┐
 func.h3_to_parent(635318325446452991, 12) 
├───────────────────────────────────────────┤
                        630814725819082751 
└───────────────────────────────────────────┘

SQL Syntax

H3_TO_PARENT(h3, parent_res)

SQL Examples

SELECT H3_TO_PARENT(635318325446452991, 12);

┌──────────────────────────────────────┐
 h3_to_parent(635318325446452991, 12) 
├──────────────────────────────────────┤
                   630814725819082751 
└──────────────────────────────────────┘

37 - H3_TO_STRING

Converts the representation of the given H3 index to the string representation.

Analyze Syntax

func.h3_to_string(h3)

Analyze Examples

func.h3_to_string(635318325446452991)

┌───────────────────────────────────────┐
 func.h3_to_string(635318325446452991) 
├───────────────────────────────────────┤
 8d11aa6a38826ff                       
└───────────────────────────────────────┘

SQL Syntax

H3_TO_STRING(h3)

SQL Examples

SELECT H3_TO_STRING(635318325446452991);

┌──────────────────────────────────┐
 h3_to_string(635318325446452991) 
├──────────────────────────────────┤
 8d11aa6a38826ff                  
└──────────────────────────────────┘

38 - H3_UNIDIRECTIONAL_EDGE_IS_VALID

Determines if the provided H3Index is a valid unidirectional edge index. Returns 1 if it's a unidirectional edge and 0 otherwise.

Analyze Syntax

func.h3_unidirectional_edge_is_valid(h3)

Analyze Examples

func.h3_unidirectional_edge_is_valid(1248204388774707199)

┌───────────────────────────────────────────────────────────┐
 func.h3_unidirectional_edge_is_valid(1248204388774707199) 
├───────────────────────────────────────────────────────────┤
 true                                                      
└───────────────────────────────────────────────────────────┘

SQL Syntax

H3_UNIDIRECTIONAL_EDGE_IS_VALID(h3)

SQL Examples

SELECT H3_UNIDIRECTIONAL_EDGE_IS_VALID(1248204388774707199);

┌──────────────────────────────────────────────────────┐
 h3_unidirectional_edge_is_valid(1248204388774707199) 
├──────────────────────────────────────────────────────┤
 true                                                 
└──────────────────────────────────────────────────────┘

39 - POINT_IN_POLYGON

Calculates whether a given point falls within the polygon formed by joining multiple points. A polygon is a closed shape connected by coordinate pairs in the order they appear. Changing the order of coordinate pairs can result in a different shape.

Analyze Syntax

func.point_in_polygon((x,y), [(a,b), (c,d), (e,f) ... ])

Analyze Examples

func.point_in_polygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)])

┌─────────────────────────────────────────────────────────────────┐
 func.point_in_polygon((3, 3), [(6, 0), (8, 4), (5, 8), (0, 2)]) 
├─────────────────────────────────────────────────────────────────┤
                                                               1 
└─────────────────────────────────────────────────────────────────┘

SQL Syntax

POINT_IN_POLYGON((x,y), [(a,b), (c,d), (e,f) ... ])

SQL Examples

SELECT POINT_IN_POLYGON((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]);

┌────────────────────────────────────────────────────────────┐
 point_in_polygon((3, 3), [(6, 0), (8, 4), (5, 8), (0, 2)]) 
├────────────────────────────────────────────────────────────┤
                                                          1 
└────────────────────────────────────────────────────────────┘

40 - STRING_TO_H3

Converts the string representation to H3 (uint64) representation.

Analyze Syntax

func.string_to_h3(h3)

Analyze Examples

func.string_to_h3('8d11aa6a38826ff')

┌──────────────────────────────────────┐
 func.string_to_h3('8d11aa6a38826ff') 
├──────────────────────────────────────┤
                   635318325446452991 
└──────────────────────────────────────┘

SQL Syntax

STRING_TO_H3(h3)

SQL Examples

SELECT STRING_TO_H3('8d11aa6a38826ff');

┌─────────────────────────────────┐
 string_to_h3('8d11aa6a38826ff') 
├─────────────────────────────────┤
              635318325446452991 
└─────────────────────────────────┘