Search code examples
gogeoh3

How to find the neighbour indexes/cells of a base cell at a given radius(Km) in the H3 library


I have no idea how to find the neighbouring cells of the base cell at a given radius(Km). How can I achieve this? If possible for the h3-go library as I am familiar with Go.


Solution

  • The answer here depends on whether you want a true radius check, or a fast approximation using kRing. You can find a discussion and example code (in JavaScript) in this Observable notebook. The basic algorithm is

    1. Determine the grid cell radius corresponding to the true distance radius you want
    2. Call kRing(origin, gridDistance) to get the set of cells within that gridDistance.

    This is much faster than a true radius check, but slightly less accurate.