neighbors method

Map<String, String> neighbors(
  1. String geohash
)

Returns a Map<String, String> containing the Direction as the key and the value being the geohash of the neighboring geohash in that direction.

Implementation

Map<String, String> neighbors(String geohash) {
  _ensureValid(geohash);
  var adjacentN = _adjacent(geohash: geohash, direction: _Direction4.NORTH);
  var adjacentS = _adjacent(geohash: geohash, direction: _Direction4.SOUTH);
  return {
    Direction.NORTH.name: adjacentN,
    Direction.NORTHEAST.name:
        _adjacent(geohash: adjacentN, direction: _Direction4.EAST),
    Direction.EAST.name:
        _adjacent(geohash: geohash, direction: _Direction4.EAST),
    Direction.SOUTHEAST.name:
        _adjacent(geohash: adjacentS, direction: _Direction4.EAST),
    Direction.SOUTH.name: adjacentS,
    Direction.SOUTHWEST.name:
        _adjacent(geohash: adjacentS, direction: _Direction4.WEST),
    Direction.WEST.name:
        _adjacent(geohash: geohash, direction: _Direction4.WEST),
    Direction.NORTHWEST.name:
        _adjacent(geohash: adjacentN, direction: _Direction4.WEST),
    Direction.CENTRAL.name: geohash
  };
}