Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes computation of geohash neighbours #7247

Closed
wants to merge 0 commits into from

Conversation

Projects
None yet
3 participants
@colings86
Copy link
Member

commented Aug 12, 2014

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.

Closes #7226

@colings86 colings86 added the review label Aug 12, 2014

@colings86

This comment has been minimized.

Copy link
Member Author

commented Aug 12, 2014

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.

Thoughts?

@clintongormley

This comment has been minimized.

Copy link
Member

commented Aug 12, 2014

That sounds sensible.

@jpountz jpountz removed the review label Aug 13, 2014

@jpountz

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2014

LGTM

+1 also to improve the way that neighbors are computed, but I would be totally fine with doing it in another PR.

@colings86

This comment has been minimized.

Copy link
Member Author

commented Aug 13, 2014

Pushed to master, 1.x and 1.3

@colings86 colings86 closed this Aug 13, 2014

@colings86 colings86 self-assigned this Aug 21, 2014

@colings86 colings86 deleted the colings86:fix/7226 branch Aug 21, 2014

@clintongormley clintongormley changed the title Geo: fixes computation of geohash neighbours Fixes computation of geohash neighbours Jun 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.