Order of items in geohash.neighbors does not match documentation.
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
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
Original comment by [email protected] on 18 Dec 2012 at 1:17
- Added labels: Type-Enhancement, Priority-Low
- Removed labels: Type-Defect, Priority-Medium
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
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
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
I need the order badly. Could you offer another format?
Original comment by [email protected] on 12 Sep 2014 at 8:37
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
module 'geohash' has no attribute 'neighbors',why is this?