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

Order of items in geohash.neighbors does not match documentation. #16

Open
GoogleCodeExporter opened this issue Oct 5, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

The documentation shows:

>>> geohash.neighbors('ezs42')
['ezefr', 'ezs43', 'ezefx', 'ezs48', 'ezs49', 'ezefp', 'ezs40', 'ezs41']

I get the following when I run the same line in OSX on python-geohash==0.8.4:

Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin

>>> geohash.neighbors('ezs42')
['ezefr', 'ezs43', 'ezs40', 'ezefp', 'ezs41', 'ezs48', 'ezefx', 'ezs49']

If the order is indeterminate a dict would be a better choice so that you could 
predictably get a specific neighboring geohash.

Original issue reported on code.google.com by [email protected] on 18 Jul 2012 at 10:44

@GoogleCodeExporter
Copy link
Author

set() may be better than dict. But I would leave this as list. The order does 
not matter. If you don't like the documentation, I'll fix it later.

Original comment by [email protected] on 18 Dec 2012 at 1:12

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 18 Dec 2012 at 1:17

  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Author

The order matters if you're trying to traverse a series of geohashes in a 
particular direction.

Original comment by [email protected] on 18 Dec 2012 at 3:07

@GoogleCodeExporter
Copy link
Author

FWIW, results seem to follow the this order: center row left/right cell, bottom 
row center/left/right cell, top row center/left/right cell for each query.

Original comment by [email protected] on 7 Feb 2013 at 12:38

@GoogleCodeExporter
Copy link
Author

There're not always 8 neighbors. If you go near polar, neighbors will be 5 or 
less. If you want to know the relation of direction and hash code, we need 
another format.

Original comment by [email protected] on 13 Aug 2014 at 7:30

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

I need the order badly. Could you offer another format?

Original comment by [email protected] on 12 Sep 2014 at 8:37

@GoogleCodeExporter
Copy link
Author

I would spare some ordering, too.

I'm working with this code now, and I need to know the adjacent squares.

I could do some bucketing function to get the distribution of a collection of 
points around a geohash (3x3 square), but I need 2x2 square instead. So, 
knowing the order of the neighboring hashes, or the adjacency of two given 
hashes, I could get this done.

Original comment by [email protected] on 31 Oct 2014 at 10:52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant