Skip to contents

This function returns all the H3 cell indexes within a specified number of steps from the address supplied, grouped by step.

Usage

get_disk_list(h3_address = NULL, ring_size = 1, simple = TRUE)

Arguments

h3_address

Character; 15-character cell index generated by H3.

ring_size

Character; number of steps away from the central cell. Defaults to 1.

simple

Logical; whether to return a vector of outputs or a data frame containing both inputs and outputs.

Value

By default, a list of length(h3_address). Each list element contains a list of length(ring_size + 1). Each of those lists contains a character vector of H3 cell indices belonging to that step away from the input cell.

Note

In total, the number of indices returned for each input cell conforms to the centered hexagonal number sequence, so at ring_size = 5, 91 cells are returned. Cells are returned in separate lists, one for each step.

Examples

# What are the nested neighbours of this cell within two steps?
get_disk_list(h3_address = '86be8d12fffffff', ring_size = 2)
#> [[1]]
#> [[1]][[1]]
#> [1] "86be8d12fffffff"
#> 
#> [[1]][[2]]
#> [1] "86be8d127ffffff" "86be8d107ffffff" "86be8d10fffffff" "86be8d177ffffff"
#> [5] "86be8d8dfffffff" "86be8d8d7ffffff"
#> 
#> [[1]][[3]]
#>  [1] "86be8d88fffffff" "86be8d89fffffff" "86be8d137ffffff" "86be8d117ffffff"
#>  [5] "86be8d11fffffff" "86be8d027ffffff" "86be8d157ffffff" "86be8d147ffffff"
#>  [9] "86be8d167ffffff" "86be8d8cfffffff" "86be8d8c7ffffff" "86be8d8f7ffffff"
#> 
#>