h3_distance: Get the grid distance between two H3 (hexagon) indexes

Description Usage Arguments Value Note Examples

View source: R/h3_info.R

Description

Get the grid distance between two H3 (hexagon) indexes

Usage

1
h3_distance(origin_h3_index, destination_h3_index)

Arguments

origin_h3_index

H3 index (origin); character vector

destination_h3_index

H3 index (destination); character (single value)

Value

numeric vector

Note

This function may fail to find the distance between two indexes if they are very far apart or on opposite sides of a pentagon.

Examples

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)

crazycapivara/h3forr documentation built on Dec. 6, 2020, 5:21 a.m.