Description Usage Arguments Value Note Examples
Get the grid distance between two H3 (hexagon) indexes
1 | h3_distance(origin_h3_index, destination_h3_index)
|
origin_h3_index |
H3 index (origin); character vector |
destination_h3_index |
H3 index (destination); character (single value) |
numeric vector
This function may fail to find the distance between two indexes if they are very far apart or on opposite sides of a pentagon.
1 2 3 4 5 6 | coords <- c(37.36156, -122.05532)
h3_index <- geo_to_h3(coords)
neighbors <- k_ring(h3_index, 2)
h3_distance(neighbors, h3_index)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.