in packages/geofire-common/src/index.ts [345:359]
export function geohashQueryBounds(center: Geopoint, radius: number): GeohashRange[] {
validateLocation(center);
const queryBits = Math.max(1, boundingBoxBits(center, radius));
const geohashPrecision = Math.ceil(queryBits / BITS_PER_CHAR);
const coordinates = boundingBoxCoordinates(center, radius);
const queries = coordinates.map((coordinate) => {
return geohashQuery(geohashForLocation(coordinate, geohashPrecision), queryBits);
});
// remove duplicates
return queries.filter((query, index) => {
return !queries.some((other, otherIndex) => {
return index > otherIndex && query[0] === other[0] && query[1] === other[1];
});
});
}