Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixes computation of geohash neighbours #7247
The geohash grid it 8 cells wide and 4 cells tall. GeoHashUtils.neighbor(String,int,int.int) set the limit of the number of cells in y to < 3 rather than <= 3 resulting in it either not finding all neighbours or incorrectly searching for a neighbour in a different parent cell.
I actually think this code should be changed to work out the neighbours from the complete geohash in one go rather than doing it level by level. This would be more efficient as there is a 20 in 32 chance of a random geohash being on the edge of a parent cell so we end up doing a lot of computation at different levels. Instead we should decode the full geohash into its odd and even components, add/subtract from the relevant component and then re-encode to get the final result. It would also make the code a lot easier to follow.