Order of items in geohash.neighbors does not match documentation.
Opened this issue · 7 comments
GoogleCodeExporter commented
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 hollowa...@gmail.com
on 18 Jul 2012 at 10:44
GoogleCodeExporter commented
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 Hiroaki.Kawai@gmail.com
on 18 Dec 2012 at 1:12
GoogleCodeExporter commented
Original comment by Hiroaki.Kawai@gmail.com
on 18 Dec 2012 at 1:17
- Added labels: Priority-Low, Type-Enhancement
- Removed labels: Priority-Medium, Type-Defect
GoogleCodeExporter commented
The order matters if you're trying to traverse a series of geohashes in a
particular direction.
Original comment by hollowa...@gmail.com
on 18 Dec 2012 at 3:07
GoogleCodeExporter commented
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 t...@patugo.com
on 7 Feb 2013 at 12:38
GoogleCodeExporter commented
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 Hiroaki.Kawai@gmail.com
on 13 Aug 2014 at 7:30
- Changed state: Started
GoogleCodeExporter commented
I need the order badly. Could you offer another format?
Original comment by pando...@gmail.com
on 12 Sep 2014 at 8:37
GoogleCodeExporter commented
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 paulo...@gmail.com
on 31 Oct 2014 at 10:52