Skip to content

Commit

Permalink
More varchar functions (traversal, directededge, vertex) (#125)
Browse files Browse the repository at this point in the history
* upgrade to main

* upgrade to main again

* update

* register ext

* incorporate version number

* update

* update to latest

* local ij varchar

* grid distance varchar

* grid path cells

* grid functions varchar

* directed edge

* directed edge tests

* vertex functions

* readme

* revert duckdb to v1.0.0

* revert v1.1.0 change
  • Loading branch information
isaacbrodsky authored Sep 9, 2024
1 parent 8f2ebc1 commit f852f33
Show file tree
Hide file tree
Showing 7 changed files with 927 additions and 67 deletions.
91 changes: 45 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,70 +29,69 @@ This extension implements the entire [H3 API](https://h3geo.org/docs/api/indexin

All functions support H3 indexes specified as `UBIGINT` (`uint64`) or `BIGINT` (`int64`),
but the unsigned one is preferred and is returned when the extension can't detect which
one to use. The unsigned and signed APIs are identical. Many functions also support
`VARCHAR` H3 index input and output.
one to use. The unsigned and signed APIs are identical. Most functions also support
`VARCHAR` H3 index input and output, except as noted below.

### Full list of functions

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

### Notes

* <i id="fv">v</i>: Supports VARCHAR, UBIGINT, and BIGINT input and output.
* <i id="fi">i</i>: Supports UBIGINT and BIGINT input and output. (TODO for these to support VARCHAR too.)
* <i id="fi">i</i>: Supports UBIGINT and BIGINT input and output only, not VARCHAR. (TODO)
* <i id="fu">u</i>: Supports UBIGINT output only.

# Alternative download / install
Expand Down
Loading

0 comments on commit f852f33

Please sign in to comment.