Search Shortcut cmd + k | ctrl + k
h3

Hierarchical hexagonal indexing for geospatial data

Maintainer(s): isaacbrodsky

Installing and Loading

INSTALL h3 FROM community;
LOAD h3;

Example

SELECT h3_latlng_to_cell(37.7887987, -122.3931578, 9);

About h3

The H3 extension adds support for the H3 hierarchical hexagonal grid system.

Added Functions

function_name function_type description comment examples
h3_latlng_to_cell scalar Convert latitude/longitude coordinate to cell ID NULL [NULL]
h3_latlng_to_cell_string scalar Convert latitude/longitude coordinate to cell ID (returns VARCHAR) NULL [NULL]
h3_cell_to_lat scalar Convert cell ID to latitude NULL [NULL]
h3_cell_to_lng scalar Convert cell ID to longitude NULL [NULL]
h3_cell_to_latlng scalar Convert cell ID to latitude/longitude NULL [NULL]
h3_cell_to_boundary_wkt scalar Convert cell ID to cell boundary NULL [NULL]
h3_get_resolution scalar Get resolution number of cell ID NULL [NULL]
h3_get_base_cell_number scalar Get base cell number of cell ID NULL [NULL]
h3_string_to_h3 scalar Convert VARCHAR cell ID to UBIGINT NULL [NULL]
h3_h3_to_string scalar Convert BIGINT or UBIGINT cell ID to VARCHAR NULL [NULL]
h3_is_valid_cell scalar True if this is a valid cell ID NULL [NULL]
h3_is_res_class_iii scalar True if the cell's resolution is class III NULL [NULL]
h3_is_pentagon scalar True if the cell is a pentagon NULL [NULL]
h3_get_icosahedron_faces scalar List of icosahedron face IDs the cell is on NULL [NULL]
h3_cell_to_parent scalar Get coarser cell for a cell NULL [NULL]
h3_cell_to_children scalar Get finer cells for a cell NULL [NULL]
h3_cell_to_center_child scalar Get the center finer cell for a cell NULL [NULL]
h3_cell_to_child_pos scalar Get a sub-indexing number for a cell inside a parent NULL [NULL]
h3_child_pos_to_cell scalar Convert parent and sub-indexing number to a cell ID NULL [NULL]
h3_compact_cells scalar Convert a set of single-resolution cells to the minimal mixed-resolution set NULL [NULL]
h3_uncompact_cells scalar Convert a mixed-resolution set to a single-resolution set of cells NULL [NULL]
h3_grid_disk scalar Find cells within a grid distance NULL [NULL]
h3_grid_disk_distances scalar Find cells within a grid distance, sorted by distance NULL [NULL]
h3_grid_disk_unsafe scalar Find cells within a grid distance, with no pentagon distortion NULL [NULL]
h3_grid_disk_distances_unsafe scalar Find cells within a grid distance, sorted by distance, with no pentagon distortion NULL [NULL]
h3_grid_disk_distances_safe scalar Find cells within a grid distance, sorted by distance NULL [NULL]
h3_grid_ring_unsafe scalar Find cells exactly a grid distance away, with no pentagon distortion NULL [NULL]
h3_grid_path_cells scalar Find a grid path to connect two cells NULL [NULL]
h3_grid_distance scalar Find the grid distance between two cells NULL [NULL]
h3_cell_to_local_ij scalar Convert a cell ID to a local I,J coordinate space NULL [NULL]
h3_local_ij_to_cell scalar Convert a local I,J coordinate to a cell ID NULL [NULL]
h3_cell_to_vertex scalar Get the vertex ID for a cell ID and vertex number NULL [NULL]
h3_cell_to_vertexes scalar Get all vertex IDs for a cell ID NULL [NULL]
h3_vertex_to_lat scalar Convert a vertex ID to latitude NULL [NULL]
h3_vertex_to_lng scalar Convert a vertex ID to longitude NULL [NULL]
h3_vertex_to_latlng scalar Convert a vertex ID to latitude/longitude coordinate NULL [NULL]
h3_is_valid_directed_edge scalar True if passed a valid directed edge ID NULL [NULL]
h3_origin_to_directed_edges scalar Get all directed edge IDs for a cell ID NULL [NULL]
h3_directed_edge_to_cells scalar Convert a directed edge ID to origin/destination cell IDs NULL [NULL]
h3_get_directed_edge_origin scalar Convert a directed edge ID to origin cell ID NULL [NULL]
h3_get_directed_edge_destination scalar Convert a directed edge ID to destination cell ID NULL [NULL]
h3_cells_to_directed_edge scalar Convert an origin/destination pair to directed edge ID NULL [NULL]
h3_are_neighbor_cells scalar True if the two cell IDs are directly adjacent NULL [NULL]
h3_directed_edge_to_boundary_wkt scalar Convert directed edge ID to linestring WKT NULL [NULL]
h3_get_hexagon_area_avg scalar Get average area of a hexagon cell at resolution NULL [NULL]
h3_cell_area scalar Get the area of a cell ID NULL [NULL]
h3_get_hexagon_edge_length_avg scalar Average hexagon edge length at resolution NULL [NULL]
h3_edge_length scalar Get the length of a directed edge ID NULL [NULL]
h3_get_num_cells scalar Get the number of cells at a resolution NULL [NULL]
h3_get_res0_cells scalar Get all resolution 0 cells NULL [NULL]
h3_get_res0_cells_string scalar Get all resolution 0 cells (returns VARCHAR) NULL [NULL]
h3_get_pentagons scalar Get all pentagons at a resolution NULL [NULL]
h3_get_pentagons_string scalar Get all pentagons at a resolution (returns VARCHAR) NULL [NULL]
h3_great_circle_distance scalar Compute the great circle distance between two points (haversine) NULL [NULL]
h3_cells_to_multi_polygon_wkt scalar Convert a set of cells to multipolygon WKT NULL [NULL]
h3_polygon_wkt_to_cells scalar Convert polygon WKT to a set of cells NULL [NULL]
h3_polygon_wkt_to_cells_string scalar Convert polygon WKT to a set of cells (returns VARCHAR) NULL [NULL]
h3_polygon_wkt_to_cells_experimental scalar Convert polygon WKT to a set of cells new algorithm [NULL]
h3_polygon_wkt_to_cells_experimental_string scalar Convert polygon WKT to a set of cells new algorithm (returns VARCHAR) [NULL]
h3_is_valid_vertex scalar True if passed a valid vertex ID NULL [NULL]